* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

/* фикс для онлайн-страниц: скрытые оверлеи не должны висеть на старте */
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  padding: 16px 12px 24px;
  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;
}

.game {
  width: 100%;
  max-width: 640px;
  background: #fffdf5;
  border: 1.5px solid #b8862c;
  border-radius: 16px;
  padding: 20px 20px 22px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.game-head { text-align: center; }

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

.game-sub {
  margin: 0;
  color: #8a7a4a;
  font-size: 15px;
  line-height: 1.4;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.seg {
  display: inline-flex;
  border: 1.5px solid #5a8835;
  border-radius: 10px;
  overflow: hidden;
}

.seg-btn {
  font-family: inherit;
  font-size: 14px;
  padding: 8px 14px;
  border: none;
  background: #fffdf5;
  color: #4a6b2a;
  cursor: pointer;
}

.seg-btn + .seg-btn { border-left: 1.5px solid #5a8835; }

.seg-btn.is-active {
  background: #c8d8a4;
  color: #3a5520;
  font-weight: 700;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.chip {
  font-family: inherit;
  font-size: 12.5px;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1.5px dashed #b8862c;
  background: #fffdf5;
  color: #8a7a4a;
  cursor: pointer;
}

.chip.is-on {
  border-style: solid;
  background: #f3ecd2;
  color: #5a4a20;
  font-weight: 700;
}

.btn-new {
  font-family: inherit;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1.5px solid #5a8835;
  background: #c8d8a4;
  color: #3a5520;
  font-weight: 700;
  cursor: pointer;
}

.btn-new:hover { background: #d6e4b6; }

.progress {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #8a7a4a;
  padding: 0 4px;
}

#score-text { font-weight: 700; color: #e0762e; }

.board-wrap { position: relative; }

.task-card {
  border: 1.5px solid #e3d8b6;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffdf5 0%, #fdf6e3 100%);
  padding: 18px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 300px;
}

.task-icon {
  font-size: 34px;
  text-align: center;
  line-height: 1;
}

.task-text {
  margin: 0;
  font-size: 17px;
  line-height: 1.5;
}

.task-question {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #4a6b2a;
}

.task-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opt-btn {
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  font-size: 17px;
  border: 1.5px solid #b8862c;
  border-radius: 12px;
  background: #fffdf5;
  color: #3a3320;
  cursor: pointer;
  text-align: left;
}

.opt-btn:not(:disabled):hover { background: #f3ecd2; }

.opt-e { font-size: 22px; flex: none; }

.opt-btn.is-right {
  border: 2.5px solid #5a8835;
  background: #e7f0d3;
  font-weight: 700;
}

.opt-btn.is-wrong {
  border: 2.5px solid #c0392b;
  background: #fbe3df;
  animation: shake 0.35s;
}

.opt-btn:disabled { cursor: default; opacity: 0.92; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.task-explain {
  border-left: 3px solid #5a8835;
  background: #f1f5e2;
  border-radius: 0 10px 10px 0;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.explain-verdict { font-weight: 700; font-size: 16px; }
.explain-verdict.is-good { color: #3a6b1e; }
.explain-verdict.is-bad { color: #c0392b; }

.explain-text {
  font-size: 14.5px;
  line-height: 1.5;
  color: #4a5a30;
}

.btn-next { align-self: flex-end; }

.win {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 253, 245, 0.88);
  border-radius: 14px;
}

.win-card {
  text-align: center;
  background: #fffdf5;
  border: 2px solid #5a8835;
  border-radius: 16px;
  padding: 26px 34px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.win-emoji { font-size: 44px; line-height: 1; }
.win-title { font-size: 22px; font-weight: 700; color: #4a6b2a; }
.win-result { font-size: 15px; color: #5a4a20; }
.win-stars { font-size: 28px; letter-spacing: 4px; }
.win-btn { align-self: center; }

.game-foot {
  margin: 0;
  text-align: center;
  font-size: 13px;
  color: #8a7a4a;
  font-style: italic;
}

@media (max-width: 480px) {
  .game { padding: 14px 12px 16px; }
  .task-text { font-size: 16px; }
  h1 { font-size: 22px; }
}

/* --- числовые варианты ответа --- */
.task-options { justify-content: center; }
.opt-num {
  justify-content: center;
  min-width: 64px;
  font-size: 30px;
  font-weight: 700;
  color: #1a3a5a;
  padding: 12px 18px;
}

/* --- кнопка «Послушать» --- */
.btn-listen {
  align-self: center;
  margin-bottom: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1.5px solid #5a8835;
  background: #eaf3d8;
  color: #3a5520;
  cursor: pointer;
}
.btn-listen:hover { background: #dcebc2; }
.btn-listen:active { transform: scale(0.97); }

/* --- картинки-опоры на экране --- */
.task-pics {
  text-align: center;
  font-size: 24px;
  line-height: 1.5;
  margin: 4px 0 2px;
  word-break: break-word;
}
.pic-grp { white-space: normal; }
.pic-plus { margin: 0 8px; font-weight: 700; color: #8a7a4a; }
.pic-vs { margin: 0 10px; font-style: italic; color: #8a7a4a; font-size: 18px; }
