:root {
  --bg: #0f1b3d;
  --card: #1b2b5e;
  --text: #f4f7ff;
  --accent: #ffcf3f;
  --good: #3ecf8e;
  --bad: #ff6b6b;
  --btn: #3a56c5;
}
* { box-sizing: border-box; }
html { font-size: 18px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background-image: radial-gradient(circle at 20% 10%, #24387a 0, transparent 40%),
                    radial-gradient(circle at 85% 80%, #2a2563 0, transparent 40%);
  min-height: 100vh;
}
main { max-width: 720px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.6rem; margin: .4em 0; }
h2 { font-size: 1.2rem; margin: 1em 0 .2em; }
[hidden] { display: none !important; }
code { background: #00000044; padding: 0 .3em; border-radius: 4px; }

button {
  font: inherit; color: var(--text); background: var(--btn);
  border: 2px solid transparent; border-radius: 14px;
  min-height: 48px; min-width: 48px; padding: 10px 18px; cursor: pointer;
}
button:hover:not(:disabled) { filter: brightness(1.15); }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button.big { background: var(--accent); color: #1b1b1b; font-weight: 700; width: 100%; margin-top: 12px; }
button.good { background: var(--good); color: #0b2b1d; }
button.bad { background: var(--bad); color: #3a0b0b; }
.options button[aria-pressed="true"] { outline: 3px solid var(--accent); }
button[aria-pressed="true"] { background: var(--accent); color: #1b1b1b; font-weight: 700; }
input[type=text] {
  font: inherit; width: 100%; min-height: 48px; padding: 8px 14px;
  border-radius: 14px; border: 2px solid #5a73d8; background: #0b1533; color: var(--text);
}
label { display: block; margin: .8em 0 .3em; }

.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.row.top { align-items: center; flex-wrap: nowrap; }
.grades { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.grades button { padding: 8px 0; min-width: 0; }

/* робот */
.robot-slot { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.robot-slot svg { width: 84px; height: 96px; flex: none; }
.bubble {
  background: var(--card); border-radius: 18px; padding: 12px 16px;
  position: relative; flex: 1; min-height: 3em; display: flex; align-items: center;
}
.bubble::before {
  content: ""; position: absolute; left: -10px; top: 50%; margin-top: -8px;
  border: 8px solid transparent; border-right-color: var(--card); border-left: 0;
}

/* карта */
.map-row { display: flex; gap: 14px; align-items: flex-start; }
.map-row .stack { flex: 1; }
.rocket-box { width: 90px; flex: none; }
.rocket-box svg { width: 100%; height: auto; }
.planet {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  text-align: left; background: var(--card); border-color: #3a56c5;
}
.planet .stars { color: var(--accent); letter-spacing: 2px; white-space: nowrap; }

/* задание */
.progress-wrap { flex: 1; display: flex; align-items: center; gap: 10px; }
.progress { flex: 1; height: 14px; background: #00000055; border-radius: 8px; overflow: hidden; }
#progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
#progress-text { white-space: nowrap; font-size: .9rem; }
.question { display: flex; gap: 10px; align-items: flex-start; margin: 18px 0; font-size: 1.25rem; }
.question .speak { flex: none; padding: 6px 10px; }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.options button { font-size: 1.2rem; min-height: 56px; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.match button { font-size: 1.15rem; min-height: 56px; }
.match button.good:disabled { opacity: 1; }
.word { font-size: 2.2rem; letter-spacing: .12em; text-align: center; margin: 14px 0 18px; }
.blank { display: inline-block; min-width: 1.4em; border-bottom: 4px solid var(--accent); }
.blank.filled { color: var(--good); }
.strip {
  min-height: 64px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px; margin-bottom: 14px; border-radius: 14px; background: #00000055;
  border: 2px dashed #5a73d8; font-size: 1.2rem;
}
.strip.wrong { border-color: var(--bad); }
.strip.right { border-color: var(--good); }
.strip span { background: var(--card); padding: 8px 12px; border-radius: 10px; }

/* итог */
.stars-big { font-size: 3.2rem; text-align: center; color: var(--accent); letter-spacing: 6px; }
#screen-result .rocket-box { margin: 10px auto; width: 120px; }
.seg-new { animation: pop .8s ease-out; }
@keyframes pop { from { transform: scale(0.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* финал */
.launch { margin: 20px auto; width: 120px; animation: fly 2.4s ease-in forwards; }
@keyframes fly { from { transform: translateY(0); } to { transform: translateY(-110vh); } }
.certificate {
  background: #fffdf5; color: #222; border: 8px double #c9a227; border-radius: 12px;
  padding: 28px 18px; text-align: center;
}
.cert-art { width: 100%; height: auto; display: block; margin-bottom: 14px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.certificate h1 { font-size: 2.2rem; color: #8a6d00; margin: 0 0 .3em; }
.cert-name { font-size: 2rem; font-weight: 700; margin: .2em 0; }
.cert-stars { font-size: 1.4rem; color: #b8860b; }
.cert-sign { margin-top: 1.5em; font-style: italic; }

@media (prefers-reduced-motion: reduce) {
  .launch { animation-duration: .01s; }
  .seg-new { animation: none; }
}
@media (max-width: 480px) {
  html { font-size: 17px; }
  .map-row { flex-direction: column-reverse; align-items: stretch; }
  .rocket-box { width: 70px; align-self: center; }
  .map-row .rocket-box svg { height: 110px; }
}
@media print {
  body { background: #fff; }
  .screen:not(#screen-final):not(#screen-super), .no-print, .launch { display: none !important; }
  .certificate { border-color: #000; color: #000; }
  .certificate h1, .cert-stars { color: #000; }
  .super-certificate { box-shadow: none; background: #fff; }
}

.hint { font-size: .9rem; opacity: .85; margin: .5rem 0 0; }
.super-btn { background: linear-gradient(135deg, #fff2a8, #f5c542); color: #3a2a00; font-weight: 700; }
.super-certificate { border-color: #d4a017; border-width: 10px; background: linear-gradient(180deg, #fff8dc, #fffdf5 40%); box-shadow: 0 0 24px #f5c54288; animation: glow 3s ease-in-out infinite alternate; }
.super-certificate h1 { font-size: 2.6rem; color: #a8730a; text-shadow: 0 1px 0 #fff2a8; }
.super-certificate .cert-name { font-size: 2.4rem; }
@keyframes glow { from { box-shadow: 0 0 14px #f5c54255; } to { box-shadow: 0 0 34px #f5c542aa; } }
@media (prefers-reduced-motion: reduce) { .super-certificate { animation: none; } }
