/* «Скажи по-английски» — same palette as «Собери слово» */

:root {
  --ink: #3d2b2f;
  --muted: #8b7576;
  --sky: #d7f0ff;
  --cream: #fff8ec;
  --pig: #ff7096;          /* main colour — the listen button */
  --pig-dark: #e04f78;
  --pig-soft: #ffe1ea;
  --ok: #22a35a;
  --ok-bg: #dcf8e7;
  --bad: #e5484d;
  --mic: #3fb36b;          /* the speak button */
  --mic-dark: #2a8f52;
  --accent: #f2b31c;
  --accent-soft: #fff1c9;
  --line: #eadfcd;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--sky) 0%, var(--cream) 55%) fixed;
  color: var(--ink);
  font-family: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, sans-serif;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
button:disabled { cursor: default; }
[hidden] { display: none !important; }

/* ---------- Topics and score ---------- */

header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 0;
}

.score {
  font-size: 26px;
  font-weight: 900;
  padding: 4px 18px;
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--accent-soft);
}
.score.bump { animation: pop 0.45s ease-out; }

.topics {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 1100px;
}

.topic {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 8px;
  background: rgba(255, 255, 255, 0.7);
  border: 3px solid transparent;
  border-radius: 16px;
  transition: transform 0.15s, background 0.15s;
}
.topic:hover { transform: translateY(-2px); }
.topic.current { background: #fff; border-color: var(--accent); box-shadow: 0 4px 0 var(--accent-soft); }
.topic.done { border-color: var(--ok); }
.topic-icon { font-size: 24px; line-height: 1; }
.topic-name { font-weight: 800; font-size: 15px; }
.topic-count { font-size: 13px; color: var(--muted); }
.topic.done .topic-count { color: var(--ok); }

/* ---------- Word card ---------- */

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 16px 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.board {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.picture-box {
  width: clamp(180px, 30vh, 280px);
  aspect-ratio: 1;
  margin-bottom: 8px;
  background: #fff;
  border-radius: 32px;
  padding: 10px;
  box-shadow: 0 6px 0 var(--accent-soft), 0 10px 24px rgba(61, 43, 47, 0.08);
}
.picture { width: 100%; height: 100%; object-fit: contain; border-radius: 22px; animation: pop 0.35s ease-out; }
.picture-stub { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 110px; }

.word { font-size: 68px; font-weight: 900; line-height: 1.05; text-align: center; }
.word.ok { color: var(--ok); animation: hop 0.5s ease-out; }
.translation { font-size: 24px; color: var(--muted); text-align: center; }

/* ---------- Listen / speak ---------- */

.actions { display: flex; gap: 36px; justify-content: center; }

.round {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  padding: 0;
  font-size: 20px;
  font-weight: 800;
}
.round-icon {
  width: 104px;
  height: 104px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 48px;
  transition: transform 0.1s;
}
.listen .round-icon { background: var(--pig); box-shadow: 0 6px 0 var(--pig-dark); }
.speak .round-icon { background: var(--mic); box-shadow: 0 6px 0 var(--mic-dark); }
.round:active:not(:disabled) .round-icon { transform: translateY(4px); box-shadow: none; }
.round:disabled { opacity: 0.45; }

/* A gentle nudge towards the next button to press */
.round.hint .round-icon { animation: nudge 1.6s ease-in-out infinite; }
/* Playing / listening right now */
.listen.active .round-icon { animation: beat 0.6s ease-in-out infinite; }
.speak.active .round-icon { background: var(--bad); box-shadow: 0 6px 0 #b8363a; animation: ring 1.2s ease-out infinite; }

/* ---------- Message and buttons ---------- */

#message { margin: 0; max-width: 100%; overflow-wrap: anywhere; min-height: 1.4em; font-size: 28px; font-weight: 900; text-align: center; }
#message.ok { color: var(--ok); animation: pop 0.3s ease-out; }
#message.miss { color: var(--pig-dark); }

.controls { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.btn {
  font-size: 21px;
  font-weight: 800;
  padding: 12px 26px;
  border-radius: 999px;
  border: 3px solid var(--line);
  background: #fff;
  box-shadow: 0 4px 0 var(--line);
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.btn.primary { background: var(--pig); border-color: var(--pig); color: #fff; box-shadow: 0 4px 0 var(--pig-dark); }
.btn.primary:active:not(:disabled) { box-shadow: 0 1px 0 var(--pig-dark); }
#manual-ok { border-color: var(--mic); color: var(--mic-dark); box-shadow: 0 4px 0 var(--ok-bg); }

.note { max-width: 520px; margin: 0; font-size: 15px; color: var(--muted); text-align: center; }

/* ---------- "Topic done" dialog ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(61, 43, 47, 0.35);
}
.card {
  max-width: 440px;
  width: 100%;
  padding: 28px 24px;
  background: #fff;
  border-radius: 28px;
  text-align: center;
  box-shadow: 0 10px 0 var(--accent-soft), 0 20px 50px rgba(0, 0, 0, 0.2);
  animation: pop 0.35s ease-out;
}
.card-icon { font-size: 84px; line-height: 1.1; }
.card h2 { margin: 10px 0 6px; font-size: 30px; font-weight: 900; }
.card p { margin: 0 0 22px; color: var(--muted); font-size: 18px; }

/* ---------- Confetti ---------- */

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.confetti span { position: absolute; top: -50px; animation: fall 1.8s ease-in forwards; }

/* ---------- Animations ---------- */

@keyframes pop { 0% { transform: scale(0.85); } 70% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14%); } }
@keyframes nudge { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes beat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
@keyframes ring {
  0% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.55); }
  100% { box-shadow: 0 0 0 26px rgba(229, 72, 77, 0); }
}
@keyframes fall {
  to { transform: translate(var(--drift, 0), 110vh) rotate(540deg); opacity: 0.9; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Phone ---------- */

@media (max-width: 700px) {
  header { padding: 10px 8px 0; gap: 8px; }
  .score { font-size: 22px; }
  .topics { gap: 5px; }
  .topic { flex-direction: column; gap: 0; padding: 4px 7px; border-radius: 12px; }
  .topic-name { display: none; }
  .topic-icon { font-size: 22px; }
  .topic-count { font-size: 11px; }
  main { gap: 14px; padding-top: 12px; padding-bottom: 80px; }
  .picture-box { width: min(200px, 52vw); border-radius: 26px; padding: 8px; }
  .picture-stub { font-size: 80px; }
  .word { font-size: 48px; }
  .translation { font-size: 20px; }
  .actions { gap: 28px; }
  .round { font-size: 17px; }
  .round-icon { width: 86px; height: 86px; font-size: 40px; }
  .btn { font-size: 17px; padding: 10px 18px; }
  #message { font-size: 22px; }
}
