:root {
  --bg: #ffffff;
  --text: #111111;
  --hint: #8a8a8e;
  --button: #2ea6ff;
  --button-text: #ffffff;
  --secondary-bg: #f2f2f7;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  padding-bottom: 76px;
}

main { padding: 16px; max-width: 480px; margin: 0 auto; }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.hint { color: var(--hint); font-size: 14px; margin: 0; }

.hello { font-size: 20px; font-weight: 600; margin-bottom: 16px; }

.streak-card {
  background: var(--secondary-bg);
  border-radius: 18px;
  padding: 28px 16px;
  text-align: center;
  margin-bottom: 16px;
}
.streak-flame { font-size: 40px; line-height: 1; margin-bottom: 4px; }
.streak-num { font-size: 34px; font-weight: 700; line-height: 1.2; }

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}
.stat {
  background: var(--secondary-bg);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
}
.stat-num { font-size: 22px; font-weight: 700; margin-bottom: 2px; }

.section-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 10px;
}

.mistake-list { margin-bottom: 24px; }
.mistake-item {
  display: flex;
  justify-content: space-between;
  background: var(--secondary-bg);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 6px;
  font-size: 14px;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.badge {
  background: var(--secondary-bg);
  border-radius: 14px;
  padding: 12px 6px;
  text-align: center;
}
.badge.locked { opacity: 0.35; }
.badge-emoji { font-size: 24px; margin-bottom: 4px; }
.badge-label {
  font-size: 10.5px;
  color: var(--hint);
  margin: 0;
  line-height: 1.25;
}
.badge.achieved .badge-label { color: var(--text); }

.lang-buttons { display: flex; flex-direction: column; gap: 8px; }
.lang-btn {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--secondary-bg);
  background: var(--secondary-bg);
  color: var(--text);
  font-size: 15px;
  text-align: left;
  width: 100%;
}
.lang-btn.active {
  background: var(--button);
  color: var(--button-text);
  border-color: var(--button);
  font-weight: 600;
}

.flashcard-start-btn {
  display: block;
  width: 100%;
  padding: 14px;
  margin-bottom: 16px;
  border: none;
  border-radius: 12px;
  background: var(--button);
  color: var(--button-text);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
}

.flashcard-progress { text-align: center; margin-bottom: 10px; }
.flashcard {
  background: var(--secondary-bg);
  border-radius: 18px;
  padding: 36px 20px;
  text-align: center;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}
.flashcard-phrase { font-size: 20px; font-weight: 700; }
.flashcard-translation { font-size: 17px; color: var(--button); font-weight: 600; }

.flashcard-controls { display: flex; flex-direction: column; gap: 8px; }
.flashcard-btn {
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--button);
  color: var(--button-text);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
}
.flashcard-btn.secondary {
  background: var(--secondary-bg);
  color: var(--hint);
  font-weight: 400;
}

.saved-item {
  position: relative;
  background: var(--secondary-bg);
  border-radius: 14px;
  padding: 14px 40px 14px 16px;
  margin-bottom: 10px;
}
.saved-phrase { font-weight: 600; margin-bottom: 4px; }
.saved-translation { color: var(--hint); margin-bottom: 2px; }
.saved-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  color: var(--hint);
  font-size: 13px;
  line-height: 24px;
  padding: 0;
}

.empty-state { text-align: center; padding: 40px 20px; }
.empty-state .emoji { font-size: 40px; margin-bottom: 8px; }

.help-text { white-space: pre-line; line-height: 1.5; font-size: 15px; }

.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: var(--secondary-bg);
  border-top: 1px solid rgba(0,0,0,0.08);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-btn {
  flex: 1;
  padding: 14px 0;
  background: none;
  border: none;
  font-size: 13px;
  color: var(--hint);
  font-family: inherit;
}
.tab-btn.active { color: var(--button); font-weight: 600; }

.calendar {
  background: var(--secondary-bg);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 16px;
}
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.cal-title {
  font-weight: 600;
  font-size: 15px;
  text-transform: capitalize;
}
.cal-nav {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.cal-nav:active { background: rgba(0,0,0,0.06); }

.cal-weekdays, .cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-weekday {
  text-align: center;
  font-size: 11px;
  color: var(--hint);
  padding-bottom: 6px;
}
.cal-cell {
  aspect-ratio: 1;
  width: 30px;
  height: 30px;
  margin: 2px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border-radius: 50%;
  color: var(--text);
}
.cal-cell.empty { visibility: hidden; }
.cal-cell.active {
  background: var(--button);
  color: var(--button-text);
  font-weight: 600;
}
.cal-cell.today:not(.active) {
  border: 1.5px solid var(--button);
}
.cal-cell.future {
  color: var(--hint);
  opacity: 0.5;
}
