:root {
  --green: #58cc02;
  --green-dark: #46a302;
  --green-light: #e9f9d0;
  --red: #ff4b4b;
  --red-dark: #cc3c3c;
  --red-light: #ffe4e4;
  --ink: #1f2937;
  --muted: #9ca3af;
  --border: #f0f0f0;
  --surface: #ffffff;
  --bg: #fafafa;
}

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

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px;
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800; font-size: 0.95rem;
  cursor: pointer; border: none; outline: none;
  transition: opacity 0.15s, transform 0.1s;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--green);
  color: #fff;
  box-shadow: 0 2px 0 var(--green-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 2px solid #e5e7eb;
}

.btn-danger {
  background: var(--red);
  color: #fff;
  box-shadow: 0 2px 0 var(--red-dark);
}

/* Answer buttons */
.answer-btn {
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  border: 2px solid #e5e7eb;
  background: #fff;
  color: var(--ink);
  font-family: 'Nunito', sans-serif;
  font-weight: 700; font-size: 0.95rem;
  cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  text-align: left;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.answer-btn.correct {
  border-color: var(--green);
  background: var(--green-light);
  color: var(--green-dark);
  animation: pop 0.3s ease;
}
.answer-btn.wrong {
  border-color: var(--red);
  background: var(--red-light);
  color: var(--red-dark);
  animation: shake 0.35s ease;
}
.answer-btn .letter-chip {
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: 8px;
  background: #f3f4f6;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 0.78rem;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.answer-btn.correct .letter-chip { background: var(--green); color: #fff; }
.answer-btn.wrong   .letter-chip { background: var(--red);   color: #fff; }

/* Progress bar */
.prog-track {
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}
.prog-fill {
  height: 100%;
  background: var(--green);
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Feedback banner */
.feedback {
  border-radius: 14px;
  padding: 14px 18px;
  font-weight: 800; font-size: 0.95rem;
  display: flex; align-items: center; gap: 10px;
  animation: slide-up 0.25s ease;
}
.feedback.correct-fb { background: var(--green-light); color: var(--green-dark); }
.feedback.wrong-fb   { background: var(--red-light);   color: var(--red-dark); }

/* Stat pills */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 800; font-size: 0.78rem;
  border: 1.5px solid transparent;
}
.pill-green { background: var(--green-light); color: var(--green-dark); border-color: #c3f08a; }
.pill-gray  { background: #f3f4f6;             color: var(--ink);        border-color: #e5e7eb; }

/* Path */
.path-wrap { display: flex; flex-direction: column; align-items: center; }

.path-connector {
  width: 2px; height: 44px;
  background: #e5e7eb;
}
.path-connector.done { background: var(--green); }

.path-node-btn {
  width: 68px; height: 68px;
  border-radius: 50%;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}
.path-node-btn.state-done {
  background: var(--green);
  box-shadow: 0 3px 10px rgba(88,204,2,0.25);
  color: #fff;
}

.path-node-btn.state-current {
  background: var(--green);
  box-shadow: 0 3px 16px rgba(88,204,2,0.35);
  color: #fff;
}

.path-node-btn.state-locked {
  background: #f3f4f6;
  box-shadow: none;
  color: #d1d5db;
  cursor: not-allowed;
}

/* Pulsing ring on current */
.pulse-ring {
  position: absolute;
  width: 84px; height: 84px;
  border-radius: 50%;
  border: 2.5px solid var(--green);
  opacity: 0;
  animation: ring-pulse 2s ease-in-out infinite;
  pointer-events: none;
}

/* Score stars under completed node */
.node-stars { font-size: 0.8rem; letter-spacing: 1px; color: #f59e0b; }

/* Screen transition */
.screen { animation: slide-up 0.28s cubic-bezier(0.22,1,0.36,1); }

/* Confetti */
.confetti-particle {
  position: fixed; pointer-events: none; z-index: 9999;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
}

/* Score circle on results */
.score-circle {
  width: 120px; height: 120px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--green);
  box-shadow: 0 4px 20px rgba(88,204,2,0.15);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}

/* Keyframes */
@keyframes slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%     { transform: translateX(-6px); }
  75%     { transform: translateX(6px); }
}
@keyframes ring-pulse {
  0%   { opacity: 0.6; transform: scale(1); }
  50%  { opacity: 0;   transform: scale(1.2); }
  100% { opacity: 0;   transform: scale(1.2); }
}
@keyframes star-pop {
  0%   { transform: scale(0) rotate(-15deg); opacity: 0; }
  70%  { transform: scale(1.15) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes confetti-fall {
  0%   { transform: translateY(-10px) rotate(0deg);   opacity: 1; }
  100% { transform: translateY(100vh) rotate(600deg); opacity: 0; }
}
@keyframes bounce-in {
  0%   { transform: scale(0.7); opacity: 0; }
  70%  { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes mic-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(88,204,2,0.45); }
  70%  { box-shadow: 0 0 0 18px rgba(88,204,2,0); }
  100% { box-shadow: 0 0 0 0 rgba(88,204,2,0); }
}

/* Text input for translate */
.translate-input {
  width: 100%;
  border-radius: 14px;
  border: 2px solid #e5e7eb;
  padding: 14px 16px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
  background: #fff;
}
.translate-input:focus { border-color: var(--green); }
.translate-input:disabled { opacity: 0.7; }

/* Sound / mic circular buttons */
.audio-btn {
  width: 84px; height: 84px;
  border-radius: 50%;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: var(--green);
  color: #fff;
  box-shadow: 0 4px 0 var(--green-dark);
  transition: transform 0.1s, opacity 0.15s;
}
.audio-btn:active { transform: scale(0.95); }
.audio-btn.listening {
  animation: mic-pulse 1.3s ease-out infinite;
}

/* Mic listening state (speaking exercise) */
.mic-btn { transition: background .15s, transform .1s, box-shadow .15s; }
.mic-btn:active { transform: scale(0.95); }
.mic-listening {
  background: var(--red) !important;
  color: #fff !important;
  box-shadow: 0 4px 0 var(--red-dark);
  animation: mic-listen-pulse 1.2s ease-in-out infinite;
}
@keyframes mic-listen-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,75,75,0.5); }
  50%      { box-shadow: 0 0 0 14px rgba(255,75,75,0); }
}
.audio-btn.blue {
  background: var(--blue, #1cb0f6);
  box-shadow: 0 4px 0 #1287c2;
}

.link-listen {
  display: inline-flex; align-items: center; gap: 6px;
  color: #1cb0f6; font-weight: 800; font-size: 0.9rem;
  cursor: pointer; background: none; border: none;
}

/* Hover only on devices that truly support hover */
@media (hover: hover) and (pointer: fine) {
  .answer-btn:hover:not(:disabled) {
    border-color: var(--green);
    background: var(--green-light);
    transform: translateY(-1px);
  }
  .btn-primary:hover:not(:disabled) { opacity: 0.92; }
  .btn-ghost:hover:not(:disabled) { border-color: #d1d5db; color: var(--ink); }
  .path-node-btn.state-done:hover,
  .path-node-btn.state-current:hover { transform: scale(1.07); }
  .audio-btn:hover:not(:disabled) { opacity: 0.92; }
}
