* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  padding: 20px 14px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: linear-gradient(180deg, #f3f0e4 0%, #e7e0c8 100%);
  font-family: Georgia, 'Times New Roman', serif;
  color: #3a3320;
  -webkit-tap-highlight-color: transparent;
}

.card {
  width: 100%;
  max-width: 560px;
  background: #fffdf5;
  border: 1.5px solid #b8862c;
  border-radius: 16px;
  padding: 22px 22px 26px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.top { text-align: center; }

h1 {
  margin: 0 0 6px;
  color: #4a6b2a;
  font-size: 27px;
}

.hint {
  margin: 0 0 16px;
  color: #8a7a4a;
  font-size: 14px;
  line-height: 1.5;
}

/* ---- выбор сложности ---- */
.levels {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 14px;
}

.lvl {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 9px 16px;
  border: 1.5px solid #b8a86c;
  border-radius: 999px;
  background: #fff;
  color: #5a4a20;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .08s;
}

.lvl:hover { border-color: #5a8835; }
.lvl:active { transform: scale(.96); }

.lvl[aria-pressed="true"] {
  background: #c8d8a4;
  border-color: #5a8835;
  color: #3a5520;
}

/* ---- счёт ---- */
.scorebar {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 18px;
}

.score-box {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 16px;
  font-weight: 700;
  color: #5a4a20;
  background: rgba(232, 220, 180, 0.55);
  border: 1.5px solid #b8a86c;
  border-radius: 10px;
  padding: 6px 14px;
}

.score-ico { font-size: 18px; }

/* ---- картинки ---- */
.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.opt {
  position: relative;
  border: 2px solid #d8cda8;
  border-radius: 16px;
  background: rgba(255, 253, 245, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  font-size: clamp(48px, 18vw, 84px);
  line-height: 1;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: transform .1s, border-color .12s, background .12s, box-shadow .12s;
}

.opt:hover { border-color: #5a8835; }
.opt:active { transform: scale(.95); }

.opt:focus-visible {
  outline: 3px solid #5a8835;
  outline-offset: 2px;
}

/* верный выбор */
.opt.correct {
  border-color: #5a8835;
  background: #d6e4b6;
  box-shadow: inset 0 0 0 3px #5a8835;
  animation: pop .35s ease;
}

/* неверный выбор — мягкая ошибка */
.opt.wrong {
  border-color: #c0552f;
  background: #fbe3df;
  animation: shake .4s ease;
}

/* подсветка правильного ответа после ошибки */
.opt.reveal {
  border-color: #5a8835;
  box-shadow: inset 0 0 0 3px #5a8835;
}

/* блокировка повторных тапов после ответа */
.options.locked .opt { cursor: default; }

@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

/* ---- обратная связь ---- */
.feedback {
  min-height: 28px;
  margin: 16px 0 4px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}

.feedback.ok { color: #3a5520; }
.feedback.no { color: #8a2f12; }

/* ---- кнопка дальше ---- */
.btn-next {
  display: block;
  width: 100%;
  margin-top: 10px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  padding: 14px;
  border: 1.5px solid #5a8835;
  border-radius: 12px;
  background: #c8d8a4;
  color: #3a5520;
  cursor: pointer;
  transition: background .12s, transform .08s;
}

.btn-next:hover { background: #d6e4b6; }
.btn-next:active { transform: scale(.98); }

@media (max-width: 360px) {
  .card { padding: 18px 14px 20px; }
  .options { gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .opt, .btn-next, .lvl { transition: none; }
  .opt.correct, .opt.wrong { animation: none; }
}
