* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: #1a1a2e;
  color: #eee;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  overscroll-behavior: none;
}

body {
  display: flex;
  justify-content: center;
  padding: 1rem;
}

.app {
  width: 100%;
  max-width: 560px;
}

header h1 {
  font-size: 1.3rem;
  margin: 0 0 1rem;
  text-align: center;
  letter-spacing: 0.5px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  margin-bottom: 1.2rem;
}
.stats > div {
  background: #2a2a4a;
  padding: 0.55rem 0.3rem;
  border-radius: 0.6rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.stats .lbl {
  font-size: 0.68rem;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stats span:not(.lbl) {
  font-size: 1.05rem;
  font-weight: 600;
}

.controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}
.controls label {
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.controls input {
  width: 4.5rem;
  padding: 0.45rem;
  background: #2a2a4a;
  border: 1px solid #3a3a5a;
  color: #eee;
  border-radius: 0.4rem;
  font-size: 1rem;
  text-align: center;
}
.ghost {
  background: transparent;
  border: 1px solid #444;
  color: #ccc;
  padding: 0.45rem 0.8rem;
  border-radius: 0.4rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.card {
  background: linear-gradient(135deg, #4a4ac0 0%, #7a3aa0 100%);
  padding: 2.2rem 1rem 1.8rem;
  border-radius: 1.2rem;
  text-align: center;
  margin-bottom: 1.2rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  user-select: none;
  transition: background 0.25s ease;
}
.card.correct {
  background: linear-gradient(135deg, #2ea043 0%, #3aa05a 100%);
}
.card.wrong {
  background: linear-gradient(135deg, #cf5a5a 0%, #a03a4a 100%);
}
.russian {
  font-size: 2.2rem;
  font-weight: 600;
  margin-bottom: 1.2rem;
  min-height: 2.6rem;
  word-break: break-word;
  line-height: 1.2;
}
.audio-btn {
  background: rgba(255,255,255,0.18);
  color: #fff;
  border: none;
  padding: 0.8rem 1.6rem;
  border-radius: 0.6rem;
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 600;
}
.audio-btn:active { background: rgba(255,255,255,0.32); }

.answer {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.answer input {
  flex: 1;
  padding: 1rem;
  background: #2a2a4a;
  border: 2px solid #3a3a5a;
  color: #eee;
  border-radius: 0.6rem;
  font-size: 1.4rem;
  text-align: center;
  font-weight: 600;
  outline: none;
}
.answer input:focus {
  border-color: #5a5acf;
}
.answer input::-webkit-outer-spin-button,
.answer input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.answer input[type=number] { -moz-appearance: textfield; }

.primary {
  background: #5a5acf;
  color: #fff;
  border: none;
  padding: 1rem 1.4rem;
  border-radius: 0.6rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
.primary:active { transform: scale(0.97); }

.feedback {
  margin-bottom: 1rem;
}
.feedback-text {
  padding: 1rem;
  border-radius: 0.6rem;
  margin-bottom: 0.6rem;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
}
.feedback-text.correct {
  background: rgba(46, 160, 67, 0.2);
  border: 1px solid #2ea043;
  color: #6fdc8c;
}
.feedback-text.wrong {
  background: rgba(207, 90, 90, 0.18);
  border: 1px solid #cf5a5a;
  color: #ff9a9a;
}
.feedback-text .answer-was {
  display: block;
  font-size: 0.9rem;
  font-weight: 400;
  opacity: 0.85;
  margin-top: 0.3rem;
}
#nextBtn {
  width: 100%;
}

.hidden { display: none !important; }

.hint {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  opacity: 0.55;
  padding: 0 0.5rem;
}

@media (max-width: 380px) {
  .russian { font-size: 1.8rem; }
  .stats span:not(.lbl) { font-size: 0.95rem; }
}
