* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(ellipse at top, #1b1e1f 0%, #0c0d0e 60%);
  color: #ffffff;
  text-align: center;
  min-height: 100vh;
  padding: 20px;
}

/* ====== BACK BUTTON ====== */
.back-button {
  position: fixed;
  top: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(90, 210, 106, 0.15);
  border: 2px solid #5ad26a;
  border-radius: 8px;
  color: #5ad26a;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
  z-index: 100;
}

.back-button:hover {
  background: #5ad26a;
  color: #0c0d0e;
  transform: translateX(-4px);
}

.back-button svg {
  transition: transform 0.2s ease;
}

.back-button:hover svg {
  transform: translateX(-4px);
}

/* ====== KEYBOARD HINT ====== */
.keyboard-hint {
  font-size: 14px;
  opacity: 0.6;
  margin: 5px 0 15px;
}

kbd {
  display: inline-block;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

/* Headings */
h1 {
  font-size: clamp(28px, 6vw, 56px);
  font-weight: 800;
  margin: 30px 0 10px;
  letter-spacing: -1px;
}

.subtitle {
  font-size: 28px;
  font-weight: 700;
  margin: 20px 0 30px;
}

.subtitle .more {
  color: #4caf50;
}

/* Progress bar */
.progress-container {
  width: 60%;
  max-width: 420px;
  height: 10px;
  background: #2a2d2f;
  border-radius: 999px;
  margin: 10px auto 6px;
  overflow: hidden;
}

#progressBar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #5ad26a, #3aa64a);
  transition: width 0.3s ease;
}

#progressText {
  font-size: 13px;
  opacity: 0.7;
  margin-bottom: 30px;
}

/* Game layout */
.game {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
  flex-wrap: wrap;
}

/* Cards */
.card {
  position: relative;
  width: 360px;
  background: linear-gradient(180deg, #1a1d1f, #121415);
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  border: 3px solid transparent;
}

.card:hover,
.card:focus {
  transform: translateY(-6px);
  box-shadow:
    0 28px 60px rgba(0, 0, 0, 0.7),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  border-color: rgba(90, 210, 106, 0.5);
  outline: none;
}

.card:focus {
  border-color: #5ad26a;
}

/* Card keyboard indicator */
.card-indicator {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.card:hover .card-indicator,
.card:focus .card-indicator {
  opacity: 1;
}

.card-indicator kbd {
  font-size: 16px;
  padding: 6px 14px;
  background: rgba(90, 210, 106, 0.9);
  color: #0c0d0e;
  border-color: #5ad26a;
}

.card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

/* Card text */
.card h3 {
  margin: 14px 10px 4px;
  font-size: 20px;
  font-weight: 600;
}

.rating {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  color: #5ad26a;
  min-height: 27px;
}

/* VS text */
.vs {
  font-size: 36px;
  font-weight: 800;
  opacity: 0.6;
  margin: 0 10px;
}

/* Result + score */
#result {
  margin-top: 18px;
  font-size: 20px;
  font-weight: 600;
  min-height: 28px;
}

#result.correct {
  color: #5ad26a;
  animation: bounceIn 0.4s ease;
}

#result.wrong {
  color: #dc5050;
  animation: shake 0.4s ease;
}

@keyframes bounceIn {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  50% { transform: translateX(8px); }
  75% { transform: translateX(-8px); }
}

.score {
  margin-top: 10px;
  font-size: 18px;
  opacity: 0.85;
}

/* Correct / Wrong glow feedback */
.card.correct {
  box-shadow:
    0 0 0 3px rgba(90, 210, 106, 0.9),
    0 0 30px rgba(90, 210, 106, 0.7),
    0 25px 60px rgba(0, 0, 0, 0.7);
  border-color: #5ad26a;
}

.card.wrong {
  box-shadow:
    0 0 0 3px rgba(220, 80, 80, 0.9),
    0 0 30px rgba(220, 80, 80, 0.6),
    0 25px 60px rgba(0, 0, 0, 0.7);
  border-color: #dc5050;
}

/* Reward */
.reward {
  margin-top: 30px;
  padding: 20px;
  border-radius: 16px;
  background: linear-gradient(180deg, #1a1d1f, #121415);
  border: 2px solid #5ad26a;
  box-shadow: 0 0 40px rgba(90, 210, 106, 0.25);
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.reward h2 {
  margin-bottom: 10px;
  color: #5ad26a;
}

.hint {
  font-size: 20px;
}

.hidden {
  display: none;
}

/* Mobile */
@media (max-width: 900px) {
  h1 {
    font-size: 42px;
  }

  .game {
    gap: 20px;
  }

  .card {
    width: 90%;
    max-width: 360px;
  }

  .vs {
    display: none;
  }
  
  .keyboard-hint {
    display: none;
  }
  
  .card-indicator {
    display: none;
  }
}

@media (max-width: 500px) {
  .back-button {
    top: 10px;
    left: 10px;
    padding: 8px 12px;
  }
  
  .back-button span {
    display: none;
  }
}
