/* Import d'une police élégante et douce */
@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Poppins:wght@400;600&display=swap");

body {
  margin: 0;
  padding: 0;
  font-family: "Poppins", sans-serif;
  background-color: #e9ede6;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400' viewBox='0 0 400 400'%3E%3C!-- feuille 1 --%3E%3Cpath d='M50 80 Q60 40 80 30 Q70 60 75 85 Q60 90 50 80Z' fill='%23c8d5b9' opacity='0.5'/%3E%3Cpath d='M55 82 Q62 50 75 35' stroke='%23a3b18a' stroke-width='0.8' fill='none' opacity='0.5'/%3E%3C!-- tige 1 --%3E%3Cpath d='M58 85 Q55 110 60 130' stroke='%23a3b18a' stroke-width='1.2' fill='none' opacity='0.4'/%3E%3C!-- petite feuille --%3E%3Cpath d='M62 105 Q72 95 78 100 Q70 108 62 105Z' fill='%23d4dfd0' opacity='0.5'/%3E%3C!-- fleur simple --%3E%3Ccircle cx='60' cy='135' r='4' fill='%23dad7cd' opacity='0.4'/%3E%3Ccircle cx='60' cy='135' r='1.5' fill='%23c8d5b9' opacity='0.5'/%3E%3C!-- branche eucalyptus --%3E%3Cpath d='M320 50 Q330 80 325 120' stroke='%23a3b18a' stroke-width='1' fill='none' opacity='0.4'/%3E%3Cellipse cx='315' cy='60' rx='8' ry='5' transform='rotate(-30 315 60)' fill='%23c8d5b9' opacity='0.4'/%3E%3Cellipse cx='330' cy='75' rx='8' ry='5' transform='rotate(20 330 75)' fill='%23d4dfd0' opacity='0.4'/%3E%3Cellipse cx='318' cy='90' rx='8' ry='5' transform='rotate(-20 318 90)' fill='%23c8d5b9' opacity='0.35'/%3E%3Cellipse cx='328' cy='108' rx='7' ry='4.5' transform='rotate(15 328 108)' fill='%23d4dfd0' opacity='0.4'/%3E%3C!-- fougere --%3E%3Cpath d='M180 340 Q185 310 190 280' stroke='%23a3b18a' stroke-width='1' fill='none' opacity='0.35'/%3E%3Cpath d='M185 320 Q175 312 170 315 Q178 318 185 320Z' fill='%23c8d5b9' opacity='0.4'/%3E%3Cpath d='M186 310 Q195 302 200 306 Q193 308 186 310Z' fill='%23d4dfd0' opacity='0.4'/%3E%3Cpath d='M187 300 Q178 292 173 296 Q180 298 187 300Z' fill='%23c8d5b9' opacity='0.35'/%3E%3Cpath d='M189 290 Q197 283 202 287 Q195 288 189 290Z' fill='%23d4dfd0' opacity='0.35'/%3E%3C!-- feuille monstera simplifiee --%3E%3Cpath d='M350 300 Q340 270 355 250 Q360 270 370 265 Q365 280 375 278 Q368 295 355 305Z' fill='%23c8d5b9' opacity='0.3'/%3E%3Cpath d='M352 300 Q348 275 355 255' stroke='%23a3b18a' stroke-width='0.8' fill='none' opacity='0.35'/%3E%3C!-- petites baies --%3E%3Ccircle cx='140' cy='180' r='3' fill='%23dad7cd' opacity='0.4'/%3E%3Ccircle cx='148' cy='175' r='3' fill='%23d4dfd0' opacity='0.4'/%3E%3Ccircle cx='144' cy='185' r='2.5' fill='%23c8d5b9' opacity='0.35'/%3E%3Cpath d='M144 175 Q142 165 145 155' stroke='%23a3b18a' stroke-width='0.8' fill='none' opacity='0.3'/%3E%3C!-- grande feuille tombante --%3E%3Cpath d='M250 20 Q230 50 240 90 Q250 60 260 55 Q255 40 250 20Z' fill='%23d4dfd0' opacity='0.3'/%3E%3Cpath d='M248 25 Q238 55 242 85' stroke='%23a3b18a' stroke-width='0.8' fill='none' opacity='0.35'/%3E%3C!-- brin d herbe --%3E%3Cpath d='M90 380 Q85 350 95 330' stroke='%23a3b18a' stroke-width='1' fill='none' opacity='0.3'/%3E%3Cpath d='M95 380 Q100 355 92 335' stroke='%23c8d5b9' stroke-width='0.8' fill='none' opacity='0.3'/%3E%3C!-- petite fleur 2 --%3E%3Cpath d='M280 180 Q283 175 286 180 Q283 178 280 180Z' fill='%23dad7cd' opacity='0.4'/%3E%3Cpath d='M286 180 Q289 177 286 174 Q287 177 286 180Z' fill='%23dad7cd' opacity='0.4'/%3E%3Cpath d='M280 180 Q277 177 280 174 Q279 177 280 180Z' fill='%23dad7cd' opacity='0.4'/%3E%3Cpath d='M280 180 Q283 183 286 180 Q283 182 280 180Z' fill='%23dad7cd' opacity='0.4'/%3E%3Ccircle cx='283' cy='178' r='1.5' fill='%23c8d5b9' opacity='0.5'/%3E%3Cpath d='M283 183 Q280 200 282 215' stroke='%23a3b18a' stroke-width='0.8' fill='none' opacity='0.3'/%3E%3C!-- branche centre --%3E%3Cpath d='M190 230 Q198 195 215 165' stroke='%23a3b18a' stroke-width='1.2' fill='none' opacity='0.45'/%3E%3Cpath d='M196 210 Q182 200 176 206 Q186 209 196 210Z' fill='%23c8d5b9' opacity='0.5'/%3E%3Cpath d='M202 192 Q215 182 221 188 Q212 191 202 192Z' fill='%23d4dfd0' opacity='0.45'/%3E%3Cpath d='M194 222 Q208 214 214 220 Q204 222 194 222Z' fill='%23c8d5b9' opacity='0.45'/%3E%3C!-- feuille bas-gauche --%3E%3Cpath d='M25 280 Q38 248 60 235 Q48 260 43 285 Q33 290 25 280Z' fill='%23d4dfd0' opacity='0.45'/%3E%3Cpath d='M28 277 Q40 252 56 240' stroke='%23a3b18a' stroke-width='1' fill='none' opacity='0.5'/%3E%3C!-- brin haut-centre --%3E%3Cpath d='M140 80 Q148 52 160 28' stroke='%23a3b18a' stroke-width='1.2' fill='none' opacity='0.45'/%3E%3Cpath d='M145 62 Q133 53 128 59 Q137 61 145 62Z' fill='%23c8d5b9' opacity='0.5'/%3E%3Cpath d='M150 45 Q162 36 167 43 Q158 45 150 45Z' fill='%23d4dfd0' opacity='0.45'/%3E%3C!-- feuille droite --%3E%3Cpath d='M370 160 Q360 182 365 210 Q374 188 385 184 Q380 172 370 160Z' fill='%23c8d5b9' opacity='0.45'/%3E%3Cpath d='M369 164 Q363 183 366 206' stroke='%23a3b18a' stroke-width='1' fill='none' opacity='0.45'/%3E%3C!-- fougere gauche --%3E%3Cpath d='M12 210 Q16 188 24 162' stroke='%23a3b18a' stroke-width='1.2' fill='none' opacity='0.45'/%3E%3Cpath d='M15 195 Q5 187 2 193 Q9 195 15 195Z' fill='%23c8d5b9' opacity='0.5'/%3E%3Cpath d='M18 178 Q28 170 32 177 Q25 179 18 178Z' fill='%23d4dfd0' opacity='0.45'/%3E%3Cpath d='M13 205 Q4 200 2 205 Q8 206 13 205Z' fill='%23c8d5b9' opacity='0.45'/%3E%3C!-- petite fleur 3 --%3E%3Ccircle cx='112' cy='130' r='5' fill='%23dad7cd' opacity='0.45'/%3E%3Ccircle cx='112' cy='130' r='2' fill='%23c8d5b9' opacity='0.5'/%3E%3Cpath d='M112 135 Q109 150 110 165' stroke='%23a3b18a' stroke-width='1' fill='none' opacity='0.4'/%3E%3C!-- feuille milieu-droite --%3E%3Cpath d='M300 205 Q315 188 330 194 Q316 202 300 205Z' fill='%23d4dfd0' opacity='0.45'/%3E%3Cpath d='M302 204 Q314 192 327 195' stroke='%23a3b18a' stroke-width='0.8' fill='none' opacity='0.4'/%3E%3C!-- brin bas-droite --%3E%3Cpath d='M255 380 Q262 350 254 320' stroke='%23a3b18a' stroke-width='1.2' fill='none' opacity='0.4'/%3E%3Cpath d='M258 358 Q248 350 245 356 Q252 358 258 358Z' fill='%23c8d5b9' opacity='0.45'/%3E%3Cpath d='M256 338 Q266 330 270 337 Q263 339 256 338Z' fill='%23d4dfd0' opacity='0.4'/%3E%3C/svg%3E");
  background-size: 400px 400px;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.game-container {
  position: relative;
  background: rgba(255, 255, 255, 0.95);
  padding: 40px;
  border-radius: 30px;
  /* Bordure double très fine pour un côté "herbier" */
  border: 3px double #a3b18a;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05);
  text-align: center;
  width: 90%;
  max-width: 400px;
}

h1 {
  font-family: "Playfair Display", serif;
  font-size: 1.2rem;
  color: #588157;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 5px;
}

#total-score-display {
  font-size: 0.85rem;
  color: #a3b18a;
  margin-bottom: 15px;
}

#total-score-display .total-score-value {
  font-weight: 700;
  color: #588157;
  font-size: 1rem;
}

#word-to-translate {
  font-family: "Playfair Display", serif;
  font-size: 3.2rem;
  color: #344e41;
  /* Vert très foncé */
  margin: 15px 0;
}

.instruction {
  color: #a3b18a;
  font-style: italic;
  font-size: 0.9rem;
}

input {
  width: 100%;
  padding: 15px;
  margin: 25px 0;
  border: 1px solid #dad7cd;
  border-radius: 15px;
  background: #f8f9f8;
  font-size: 1rem;
  color: #3a5a40;
  outline: none;
  box-sizing: border-box;
  transition: all 0.3s;
}

input:focus {
  border-color: #a3b18a;
  background: #fff;
  box-shadow: 0 0 10px rgba(163, 177, 138, 0.2);
}

button {
  width: 100%;
  background: #588157;
  /* Vert feuillage */
  color: white;
  border: none;
  padding: 15px;
  border-radius: 50px;
  /* Bouton très arrondi style galet */
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

button:hover {
  background: #3a5a40;
  transform: translateY(-2px);
}

#feedback {
  margin-top: 20px;
  font-weight: 600;
  min-height: 24px;
  /* On initialise en vert foncé comme tu l'as demandé */
  color: #344e41;
}

.score-board {
  margin-top: 30px;
  font-size: 0.8rem;
  color: #588157;
  border-top: 1px solid #dad7cd;
  padding-top: 20px;
}

#score {
  font-weight: 700;
  font-size: 1.1rem;
}

/* Setup screen */
textarea {
  width: 100%;
  padding: 15px;
  margin: 10px 0;
  border: 1px solid #dad7cd;
  border-radius: 15px;
  background: #f8f9f8;
  font-family: "Poppins", sans-serif;
  font-size: 0.9rem;
  color: #3a5a40;
  outline: none;
  box-sizing: border-box;
  resize: vertical;
  transition: all 0.3s;
}

textarea:focus {
  border-color: #a3b18a;
  background: #fff;
  box-shadow: 0 0 10px rgba(163, 177, 138, 0.2);
}

.hint {
  font-size: 0.75rem;
  color: #a3b18a;
  margin: 0 0 5px;
}

.btn-secondary {
  background: transparent;
  color: #588157;
  border: 2px solid #a3b18a;
  box-shadow: none;
}

.btn-secondary:hover {
  background: #f1f3f0;
  color: #3a5a40;
  transform: translateY(-2px);
}

.separator {
  color: #a3b18a;
  font-size: 0.8rem;
  margin: 15px 0;
  font-style: italic;
}

.progress {
  font-size: 0.85rem;
  color: #a3b18a;
  margin: 0;
}

/* Grille de thèmes */
#theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 15px 0;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 5px;
}

#theme-grid::-webkit-scrollbar {
  width: 6px;
}

#theme-grid::-webkit-scrollbar-track {
  background: #f1f3f0;
  border-radius: 3px;
}

#theme-grid::-webkit-scrollbar-thumb {
  background: #a3b18a;
  border-radius: 3px;
}

.theme-btn {
  padding: 12px 10px;
  font-size: 0.85rem;
  border-radius: 15px;
  background: #f1f3f0;
  color: #344e41;
  border: 1px solid #dad7cd;
  font-weight: 600;
}

.theme-btn:hover {
  background: #588157;
  color: white;
  border-color: #588157;
  transform: translateY(-2px);
}

#end-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
}

/* Mode selection screen */
#mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 20px 0;
}

.mode-btn {
  padding: 20px 10px;
  font-size: 0.95rem;
  border-radius: 15px;
  background: #f1f3f0;
  color: #344e41;
  border: 2px solid #dad7cd;
  font-weight: 600;
}

.mode-btn:hover {
  background: #588157;
  color: white;
  border-color: #588157;
  transform: translateY(-2px);
}

#back-to-setup-btn {
  margin-top: 10px;
}

/* Matching game */
#match-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin: 20px 0;
}

.match-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.match-word {
  padding: 12px 10px;
  border-radius: 12px;
  background: #f1f3f0;
  color: #344e41;
  border: 2px solid #dad7cd;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
  user-select: none;
}

.match-word:hover:not(.matched) {
  border-color: #a3b18a;
  background: #e9ede6;
  transform: translateY(-1px);
}

.match-word.selected {
  border-color: #588157;
  background: #588157;
  color: white;
  transform: scale(1.03);
}

.match-word.matched {
  border-color: #588157;
  background: #dde5db;
  color: #588157;
  cursor: default;
  opacity: 0.7;
}

.match-word.wrong {
  border-color: #c1121f;
  background: #fde2e4;
  color: #c1121f;
}

#match-feedback {
  margin-top: 10px;
  font-weight: 600;
  min-height: 24px;
  color: #344e41;
}

#match-end-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
}

/* QCM choices */
#mcq-choices {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 15px 0;
}

.mcq-btn {
  flex: 1;
  padding: 12px 8px;
  border-radius: 15px;
  background: #f1f3f0;
  color: #344e41;
  border: 2px solid #dad7cd;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.25s ease;
}

.mcq-btn:hover {
  border-color: #a3b18a;
  background: #e9ede6;
  transform: translateY(-1px);
}

.mcq-btn.correct {
  background: #588157;
  color: white;
  border-color: #588157;
}

.mcq-btn.wrong {
  background: #fde2e4;
  color: #c1121f;
  border-color: #c1121f;
}

/* Flashcards */
.flashcard {
  perspective: 800px;
  width: 100%;
  height: 200px;
  margin: 20px 0;
  cursor: pointer;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s ease;
  transform-style: preserve-3d;
}

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

.flashcard-front,
.flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
}

.flashcard-front {
  background: #f1f3f0;
  border: 2px solid #dad7cd;
}

.flashcard-front p {
  font-family: "Playfair Display", serif;
  font-size: 2.2rem;
  color: #344e41;
  margin: 0;
}

.flashcard-back {
  background: #588157;
  border: 2px solid #3a5a40;
  transform: rotateY(180deg);
}

.flashcard-back p {
  margin: 0;
  color: white;
}

#flashcard-back-word {
  font-family: "Playfair Display", serif;
  font-size: 2rem;
}

.flashcard-hint {
  font-size: 0.85rem;
  font-style: italic;
  opacity: 0.85;
  margin-top: 10px !important;
}

#flashcard-nav {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

#flashcard-nav button {
  flex: 1;
}

#flashcard-status-btns {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.status-btn {
  flex: 1;
  background: #f1f3f0;
  color: #344e41;
  border: 2px solid #dad7cd;
  font-size: 0.9rem;
}

.status-btn:hover {
  background: #e9ede6;
  transform: translateY(-1px);
}

.status-btn.active.learning {
  border-color: #e9a820;
  background: #fdf0d5;
  color: #b07d10;
}

.status-btn.active.learned {
  border-color: #588157;
  background: #dde5db;
  color: #588157;
}

#flashcard-end-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
}

/* Saved lists grid */
#saved-lists-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 15px 0;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 5px;
}

#saved-lists-grid::-webkit-scrollbar {
  width: 6px;
}

#saved-lists-grid::-webkit-scrollbar-track {
  background: #f1f3f0;
  border-radius: 3px;
}

#saved-lists-grid::-webkit-scrollbar-thumb {
  background: #a3b18a;
  border-radius: 3px;
}

.saved-list-btn {
  padding: 12px 10px;
  font-size: 0.85rem;
  border-radius: 15px;
  background: #f1f3f0;
  color: #344e41;
  border: 1px solid #dad7cd;
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.saved-list-btn .saved-list-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.saved-list-btn .mastery-container {
  width: 100%;
}

.saved-list-btn:hover {
  background: #588157;
  color: white;
  border-color: #588157;
  transform: translateY(-2px);
}

.saved-list-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-list-delete {
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0.6;
  flex-shrink: 0;
}

.saved-list-delete:hover {
  opacity: 1;
}

/* Custom action buttons */
#custom-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.btn-small {
  padding: 10px 12px;
  font-size: 0.8rem;
}

#custom-list-name {
  margin: 10px 0 5px;
  padding: 12px 15px;
  font-size: 0.9rem;
}

/* Indicateur de scroll sur les grilles */
#theme-grid,
#saved-lists-grid {
  -webkit-overflow-scrolling: touch;
  box-shadow: inset 0 -20px 15px -15px rgba(0, 0, 0, 0.08);
}

/* Mastery badges */
.mastery-container {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}

.mastery-track {
  flex: 1;
  height: 3px;
  background: #e0e0e0;
  border-radius: 2px;
  overflow: hidden;
}

.mastery-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}

.mastery-fill.mastery-high {
  background: #588157;
}

.mastery-fill.mastery-mid {
  background: #e9a820;
}

.mastery-fill.mastery-low {
  background: #c1121f;
}

.mastery-fill.mastery-zero {
  background: #e0e0e0;
}

.mastery-pct {
  font-size: 0.6rem;
  color: #a3b18a;
  min-width: 24px;
  text-align: right;
}

/* Reset button */
.btn-reset {
  margin-top: 20px;
  background: transparent;
  color: #a3b18a;
  border: none;
  font-size: 0.75rem;
  font-weight: 400;
  padding: 8px;
  text-decoration: underline;
}

.btn-reset:hover {
  color: #c1121f;
  background: transparent;
  transform: none;
}

/* Recommendations */
#recommendations {
  margin-bottom: 15px;
}

.recommendation {
  background: #fdf0d5;
  border: 1px solid #e9a820;
  border-radius: 12px;
  padding: 10px 15px;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: #344e41;
  cursor: pointer;
  text-align: left;
  transition: all 0.3s ease;
}

.recommendation:hover {
  background: #fbe8c0;
  transform: translateY(-1px);
}

/* Crossword */
#crossword-grid {
  display: inline-grid;
  gap: 0;
  margin: 15px auto;
  border: 2px solid #ffffff;
}

.crossword-cell {
  position: relative;
  background: #fff;
  border: 1px solid #a3b18a;
}

.crossword-cell.black {
  background: #fff;
  border-color: transparent;
}

.crossword-cell .cell-number {
  position: absolute;
  top: 1px;
  left: 2px;
  font-size: 0.55rem;
  color: #588157;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  z-index: 1;
}

.crossword-cell input {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: #344e41;
  text-transform: uppercase;
  padding: 0;
  margin: 0;
  border-radius: 0;
  outline: none;
  box-sizing: border-box;
}

.crossword-cell input:focus {
  background: rgba(88, 129, 87, 0.15);
  box-shadow: none;
}

.crossword-cell.highlight {
  background: rgba(163, 177, 138, 0.2);
}

.crossword-cell.correct input {
  background: #dde5db;
  color: #588157;
}

.crossword-cell.wrong input {
  background: #fde2e4;
  color: #c1121f;
}

#crossword-clues {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin: 15px 0;
  text-align: left;
}

.crossword-clue-section h3 {
  font-family: "Playfair Display", serif;
  font-size: 0.9rem;
  color: #344e41;
  margin: 0 0 8px;
}

.crossword-clue-section ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

.crossword-clue-section li {
  font-size: 0.8rem;
  color: #3a5a40;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 2px;
}

.crossword-clue-section li:hover {
  background: #f1f3f0;
}

.crossword-clue-section li.active-clue {
  background: rgba(88, 129, 87, 0.15);
  font-weight: 600;
}

.crossword-clue-section li .clue-number {
  font-weight: 700;
  color: #588157;
  margin-right: 4px;
}

#crossword-feedback {
  margin-top: 10px;
  font-weight: 600;
  min-height: 24px;
  color: #344e41;
}

#crossword-end-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
}

/* Language selector dropdown */
#lang-selector {
  position: relative;
  display: inline-block;
  margin: 0 auto 10px;
}

.lang-toggle {
  width: auto;
  padding: 4px 10px;
  font-size: 1.3rem;
  line-height: 1;
  background: transparent;
  border: 2px solid #ccc;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
  color: #588157;
}

.lang-toggle:hover {
  background: #f1f3f0;
  border-color: #588157;
}

.lang-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  flex-direction: column;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  margin-top: 4px;
  z-index: 100;
  overflow: hidden;
}

.lang-dropdown.open {
  display: flex;
}

.lang-option {
  width: auto;
  padding: 6px 14px;
  font-size: 1.3rem;
  line-height: 1;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.lang-option:hover {
  background: #f1f3f0;
}

.lang-option.active {
  background: #dde5db;
  border-left: 3px solid #588157;
}

/* Chinese virtual keyboard */
.zh-keyboard {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 12px auto;
}

.zh-keyboard:empty {
  display: none;
}

.zh-key {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 8px;
  background: #f1f3f0;
  color: #344e41;
  border: 1px solid #dad7cd;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zh-key:hover {
  background: #dde5db;
  transform: translateY(-1px);
}

.zh-key.zh-backspace {
  background: #fde2e4;
  color: #c1121f;
  border-color: #f0c0c0;
  font-size: 1.1rem;
}

.zh-key.zh-backspace:hover {
  background: #f9cdd0;
  transform: translateY(-1px);
}

/* Mobile */
@media (max-width: 480px) {
  .game-container {
    padding: 20px;
    border-radius: 20px;
  }

  #word-to-translate {
    font-size: 2.4rem;
  }

  .flashcard-front p {
    font-size: 1.8rem;
  }

  #flashcard-back-word {
    font-size: 1.6rem;
  }

  .flashcard {
    height: 170px;
  }

  #crossword-clues {
    grid-template-columns: 1fr;
  }
}
