:root {
  --green: #58cc02;
  --green-dark: #4ba802;
  --red: #ff4b4b;
  --yellow: #ffc800;
  --gray-bg: #f7f7f7;
  --gray-line: #e5e5e5;
  --text: #3c3c3c;
  --text-soft: #777;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--gray-bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

#topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: white;
  border-bottom: 1px solid var(--gray-line);
  position: sticky; top: 0; z-index: 10;
  font-weight: 700;
}
#topbar .streak::before { content: "🔥 "; }
#topbar .hearts::before { content: "❤ "; color: var(--red); }
#topbar .xp { color: var(--green); }

#app { padding: 16px; min-height: calc(100vh - 130px); padding-bottom: 80px; }

#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex;
  background: white;
  border-top: 1px solid var(--gray-line);
  z-index: 10;
}
#tabbar button {
  flex: 1; padding: 14px 0;
  background: none; border: none;
  font-size: 14px; color: var(--text-soft);
  cursor: pointer;
}
#tabbar button.active { color: var(--green); font-weight: 700; }
#tabbar .badge {
  display: inline-block; margin-left: 4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--red); color: white;
  font-size: 11px; font-weight: 800; line-height: 18px;
  border-radius: 999px; vertical-align: 1px;
}

.review-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 12px; }
.review-actions button {
  padding: 12px 0; border: none; border-radius: 12px;
  font-weight: 800; font-size: 14px; cursor: pointer; color: white;
}
.btn-q-bad { background: var(--red); }
.btn-q-ok  { background: var(--yellow); color: #5a4500 !important; }
.btn-q-easy{ background: var(--green); box-shadow: 0 3px 0 var(--green-dark); }

.card-prompt { font-size: 28px; font-weight: 800; text-align: center; margin: 18px 0; }
.card-meta { text-align: center; color: var(--text-soft); font-size: 12px; margin-bottom: 6px; }

h1, h2 { margin: 8px 0 12px; }

.unit-card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.unit-card h2 { margin: 0 0 4px; font-size: 18px; }
.unit-card .level { font-size: 12px; color: var(--text-soft); margin-bottom: 10px; }
.lesson-pill {
  display: inline-block;
  padding: 10px 14px;
  margin: 4px 6px 4px 0;
  background: var(--green);
  color: white;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  border: none;
  cursor: pointer;
}
.lesson-pill.locked { background: var(--gray-line); color: var(--text-soft); }

.exercise {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.exercise .prompt { font-size: 13px; color: var(--text-soft); text-transform: uppercase; margin-bottom: 8px; letter-spacing: 0.5px; }
.exercise .question { font-size: 22px; font-weight: 700; margin-bottom: 18px; }

.choices { display: grid; gap: 10px; }
.choice {
  padding: 14px;
  background: white;
  border: 2px solid var(--gray-line);
  border-radius: 12px;
  font-size: 16px; font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.choice.selected { border-color: var(--green); background: #eaffd6; }
.choice.correct { border-color: var(--green); background: #d8f6b3; }
.choice.wrong { border-color: var(--red); background: #ffe3e3; }

.answer-input {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--gray-line);
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
}
.answer-input:focus { outline: none; border-color: var(--green); }

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px; font-weight: 800;
  box-shadow: 0 3px 0 var(--green-dark);
  cursor: pointer;
  margin-top: 8px;
}
.btn-primary:disabled { background: var(--gray-line); box-shadow: none; color: var(--text-soft); }

.feedback {
  padding: 14px;
  border-radius: 12px;
  margin-top: 12px;
  font-weight: 700;
}
.feedback.ok { background: #d8f6b3; color: #4ba802; }
.feedback.ko { background: #ffe3e3; color: var(--red); }

.progress-bar {
  height: 10px; background: var(--gray-line); border-radius: 10px; overflow: hidden; margin: 0 0 16px;
}
.progress-bar > div { height: 100%; background: var(--green); transition: width 0.3s; }

.tts-btn {
  background: none; border: 2px solid var(--green); color: var(--green);
  padding: 8px 14px; border-radius: 999px; cursor: pointer; font-weight: 700;
}
