/* ============================================================
   Мишоловки — графічна версія
   ============================================================ */
:root {
  --ink: #1f2937;
  --muted: #64748b;
  --purple: #7c3aed;
  --purple-dark: #5b21b6;
  --pink: #db2777;
  --mint: #10b981;
  --amber: #f59e0b;
  --paper: #ffffff;
  --line: #e2e8f0;
  --shadow: 0 14px 38px rgba(76, 29, 149, .14);
  --radius: 22px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Nunito", "Segoe UI", "Trebuchet MS", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 10%, rgba(251, 191, 36, .18), transparent 30%),
    radial-gradient(circle at 88% 20%, rgba(219, 39, 119, .13), transparent 32%),
    radial-gradient(circle at 50% 95%, rgba(16, 185, 129, .14), transparent 35%),
    linear-gradient(160deg, #f8fafc 0%, #f1eefe 100%);
  min-height: 100vh;
}

.app { max-width: 1120px; margin: 0 auto; padding: 24px 20px 60px; position: relative; }

button, input, select { font: inherit; }
/* Вказівник у формі руки мають лише справжні посилання та кнопки.
   У вправах 14–15 і 20–21 хибні варіанти свідомо зберігають звичайний курсор. */
.btn, .icon-btn, .target-pos, .num-link, .big-btn, .mini-btn, .varied-btn,
.fire-btn, .reveal-next, .scroll-next,
.text-item.is-link, .img-card.is-link { cursor: pointer; }
.btn {
  border: 0; border-radius: 14px; padding: 12px 22px;
  font-weight: 800; font-size: 16px; color: #fff;
  background: var(--purple); box-shadow: 0 6px 0 var(--purple-dark);
  transition: transform .12s, box-shadow .12s, filter .12s;
}
.btn:hover { filter: brightness(1.07); transform: translateY(-2px); box-shadow: 0 8px 0 var(--purple-dark); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--purple-dark); }
.btn-lg { padding: 16px 34px; font-size: 19px; }
.btn-ghost {
  background: #fff; color: var(--purple); border: 2px solid var(--purple);
  box-shadow: 0 4px 0 #ddd6fe;
}
.btn-ghost:hover { box-shadow: 0 6px 0 #ddd6fe; }
.btn-icon { margin-right: 6px; }
.eyebrow {
  text-transform: uppercase; letter-spacing: .13em; font-size: 12px;
  font-weight: 900; color: var(--pink); margin: 0 0 6px;
}
.lead { color: var(--muted); font-size: 17px; line-height: 1.65; }

/* ---------------- Екран вітальня ---------------- */
.start-card {
  display: grid; grid-template-columns: 340px 1fr; gap: 34px; align-items: center;
  background: var(--paper); border-radius: 30px; padding: 42px; box-shadow: var(--shadow);
  border: 1px solid #ede9fe;
}
.start-logo { display: flex; justify-content: center; }
.gfx-mouse { display: block; height: auto; max-width: 100%; }
.logo-wrap { position: relative; width: 300px; height: 300px; }
.logo-wrap .gfx-mouse { position: absolute; left: 50%; top: 12px; transform: translateX(-50%) rotate(-6deg); }
.logo-wrap .gfx-cheese { position: absolute; right: 0; top: 8px; transform: rotate(14deg); }
.logo-text {
  position: absolute; left: 50%; top: 216px; display: flex; flex-direction: column;
  background: #fff; padding: 10px 14px; border-radius: 16px;
  box-shadow: 0 8px 22px rgba(0,0,0,.09); transform: translateX(-50%) rotate(2deg);
}
.logo-text b { font-size: 26px; color: var(--purple); white-space: nowrap; }
.logo-text span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.start-copy h1 { font-size: 52px; margin: 0 0 12px; line-height: 1; color: var(--purple); }
.start-actions { display: flex; gap: 14px; flex-wrap: wrap; margin: 26px 0 8px; }
.hint-line { font-size: 13px; color: var(--muted); }
.level-picker {
  margin-top: 20px; background: #faf7ff; border: 1px solid #ede9fe;
  border-radius: 16px; padding: 14px 16px; text-align: left;
}
.picker-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 10px; }
.picker-head b { color: var(--purple); font-size: 14px; }
.picker-head span { color: var(--muted); font-size: 12px; font-weight: 800; }
.level-grid {
  display: grid; grid-template-columns: repeat(20, 1fr); gap: 5px;
  justify-items: center;
}
.level-dot {
  width: 26px; height: 26px; padding: 0; border-radius: 50%;
  border: 2px solid var(--purple-dark); background: var(--purple); color: #fff;
  font-size: 10px; font-weight: 900; line-height: 1;
  display: grid; place-items: center; transition: transform .12s, filter .12s;
  box-shadow: 0 2px 0 var(--purple-dark);
}
.level-dot:hover { transform: translateY(-3px) scale(1.15); filter: brightness(1.1); }
.level-dot:active { transform: translateY(1px); }
.level-dot.done {
  background: #d1fae5; border-color: #6ee7b7; color: #047857; box-shadow: none;
}
.level-dot.current { outline: 3px solid var(--amber); outline-offset: 2px; }
.picker-legend {
  display: flex; gap: 18px; margin-top: 10px; font-size: 11px; color: var(--muted);
}
.picker-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot {
  width: 12px; height: 12px; border-radius: 50%; display: inline-block;
  background: var(--purple); border: 1px solid var(--purple-dark);
}
.legend-dot.done { background: #d1fae5; border-color: #6ee7b7; }
.picker-note { margin: 10px 0 0; font-size: 11px; color: #94a3b8; }
.picker-note code { background: #fff; padding: 1px 6px; border-radius: 6px; color: var(--pink); }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 28px; }
.feature {
  background: #faf7ff; border: 1px solid #ede9fe; border-radius: 16px;
  padding: 14px; text-align: center; display: flex; flex-direction: column; gap: 3px;
}
.feature-icon { font-size: 26px; }
.feature b { font-size: 14px; }
.feature small { color: var(--muted); font-size: 11px; line-height: 1.3; }
.credits { text-align: center; font-size: 12px; color: #94a3b8; margin-top: 22px; }

/* ---------------- Ігровий екран ---------------- */
.hud {
  display: flex; align-items: center; gap: 16px;
  background: rgba(255,255,255,.92); border: 1px solid var(--line);
  border-radius: 18px; padding: 12px 16px; box-shadow: 0 8px 24px rgba(15,23,42,.06);
  position: sticky; top: 10px; z-index: 20; backdrop-filter: blur(8px);
}
.hud-progress { flex: 1; }
.hud-progress-top { display: flex; justify-content: space-between; font-weight: 800; font-size: 14px; margin-bottom: 7px; }
.hud-progress-top span:first-child { color: var(--purple); }
.hud-progress-top span:last-child { color: var(--muted); }
.progress-track { height: 10px; background: #ede9fe; border-radius: 99px; overflow: hidden; }
.progress-fill {
  height: 100%; width: 0; border-radius: 99px;
  background: linear-gradient(90deg, var(--pink), var(--purple), #38bdf8);
  transition: width .45s ease;
}
.hud-tools, .hud > .icon-btn { display: flex; gap: 8px; }
.done-badge {
  align-self: center; white-space: nowrap; font-size: 12px; font-weight: 900;
  color: #047857; background: #d1fae5; border-radius: 99px; padding: 6px 12px;
}
.icon-btn {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; font-size: 19px;
  display: grid; place-items: center; transition: .15s;
}
.icon-btn:hover { background: #f5f3ff; transform: translateY(-2px); }
.icon-btn.active { background: #fef3c7; border-color: var(--amber); }

.stage-wrap { display: grid; grid-template-columns: 190px 1fr; gap: 20px; margin-top: 22px; align-items: start; }
.mascot-panel { position: sticky; top: 100px; text-align: center; }
.mascot-art {
  background: #fff; border-radius: 50% 50% 22px 22px; padding: 8px;
  box-shadow: var(--shadow); display: grid; place-items: center; border: 2px solid #ede9fe;
}
.speech {
  margin: 14px auto 0; background: #fff; border: 2px solid #fbcfe8; border-radius: 16px;
  padding: 12px 10px; font-size: 13px; font-weight: 800; color: var(--pink);
  position: relative; box-shadow: 0 6px 16px rgba(0,0,0,.06);
}
.speech::before {
  content: ''; position: absolute; top: -9px; left: 50%; margin-left: -8px;
  border-left: 8px solid transparent; border-right: 8px solid transparent;
  border-bottom: 9px solid #fbcfe8;
}
.stage { min-height: 460px; }
.exercise {
  background: var(--paper); border-radius: var(--radius); padding: 28px 32px;
  box-shadow: var(--shadow); border: 1px solid #ede9fe; min-height: 440px;
}
.exercise-intro { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 22px; }
.exercise-intro p { margin: 0; font-size: 16px; line-height: 1.6; }
.exercise-badge {
  flex: 0 0 auto; background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff; font-size: 12px; font-weight: 900; padding: 7px 12px;
  border-radius: 99px; white-space: nowrap;
}
.stage.shake { animation: shake .4s ease; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-8px); } 40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); } 80% { transform: translateX(4px); }
}

/* ---------------- Ціль ---------------- */
.target-zone {
  position: relative; height: 340px; border-radius: 18px;
  background:
    radial-gradient(circle at 20% 30%, rgba(251,191,36,.12), transparent 40%),
    repeating-linear-gradient(45deg, #faf7ff 0 22px, #f5f0ff 22px 44px);
  border: 2px dashed #ddd6fe;
}
.target-pos {
  position: absolute; width: var(--sz); height: var(--sz); padding: 0;
  border: 0; background: transparent; display: grid; place-items: center;
  transition: transform .15s, filter .15s;
}
.target-pos svg { position: absolute; width: 100%; height: 100%; filter: drop-shadow(0 8px 6px rgba(0,0,0,.15)); }
.target-pos:hover { transform: scale(1.12) rotate(-5deg); filter: brightness(1.08); }
.target-pos:active { transform: scale(.94); }
.target-num {
  position: relative; z-index: 2; font-weight: 900; color: #92400e;
  text-shadow: 0 1px 0 #fff; pointer-events: none;
}
.target-pos.center { top: 45%; left: 50%; transform: translate(-50%,-50%); }
.target-pos.center:hover { transform: translate(-50%,-50%) scale(1.12) rotate(-5deg); }
.target-pos.right { top: 28%; right: 8%; }
.target-pos.bottom-right { bottom: 7%; right: 10%; }
.target-pos.bottom-left { bottom: 7%; left: 10%; }
.target-pos.top-left { top: 8%; left: 8%; }
.target-pos.left { top: 48%; left: 12%; }
.zone-decor { position: absolute; font-size: 30px; opacity: .35; }
.decor-1 { top: 14px; left: 46%; } .decor-2 { bottom: 14px; right: 40%; }

/* ---------------- Точність ---------------- */
.num-grid { display: grid; grid-template-columns: repeat(3, 62px); gap: 18px; justify-content: center; margin: 28px auto; }
.num-grid.align-left { justify-content: flex-start; margin-left: 12%; }
.num-grid.align-right { justify-content: flex-end; margin-right: 12%; }
.num-link {
  border: 0; background: transparent; color: #2563eb; text-decoration: underline;
  font-weight: 800; padding: 4px; border-radius: 8px; transition: .12s;
}
.num-link:hover { background: #fef3c7; color: var(--pink); transform: scale(1.18); }

/* ---------------- Посилання в тексті ---------------- */
.text-items { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; margin-top: 30px; }
.text-items.word .text-item { min-width: 110px; }
.text-items.phrase { flex-direction: column; align-items: center; gap: 16px; }
.text-item { border: 0; background: transparent; padding: 10px 14px; border-radius: 10px; font-size: 17px; }
.text-item:hover { outline: 2px dashed #f9a8d4; background: #fff7fb; }
.text-item.is-link:hover { transform: scale(1.05); }

/* ---------------- Кнопки ---------------- */
.center-ex { display: flex; flex-direction: column; align-items: center; text-align: center; }
.center-ex .exercise-intro { align-self: stretch; text-align: left; }
.button-demo { margin: auto 0; padding: 40px 0; }
.big-btn {
  border: 0; border-radius: 14px; padding: 16px 28px; font-size: 18px; font-weight: 900;
  transition: transform .12s, filter .12s;
}
.big-btn:hover { transform: translateY(-3px) scale(1.03); filter: brightness(1.05); }
.big-btn:active { transform: translateY(3px); }
.btn-default { background: #e2e8f0; color: #1e293b; box-shadow: 0 5px 0 #94a3b8; }
.btn-forward { background: #fff; color: #2563eb; border: 2px solid #2563eb; box-shadow: 0 5px 0 #bfdbfe; }
.btn-colorful { background: orange; color: purple; box-shadow: 0 5px 0 #fdba74; }
.btn-image { background: #fef9c3; border: 3px solid var(--amber); border-radius: 24px; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: 0 6px 0 #d97706; }
.btn-image span { font-size: 14px; color: #92400e; }
.alert-demo { margin: 20px 0; }

/* ---------------- Зображення ---------------- */
.img-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 20px; }
.img-card {
  border: 3px solid transparent; background: #f8fafc; border-radius: 18px;
  padding: 16px 8px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: .15s;
}
.img-card:hover { background: #f5f3ff; border-color: var(--purple); transform: translateY(-3px); }
.img-emoji { font-size: 52px; line-height: 1; }
.img-cap { font-size: 11px; color: var(--muted); }
.is-animated .img-emoji { animation: wiggle 1.1s ease-in-out infinite; }
@keyframes wiggle {
  0%,100% { transform: rotate(-8deg) translateY(0); }
  50% { transform: rotate(8deg) translateY(-7px); }
}

/* ---------------- Багато кліків ---------------- */
.multi-grid { display: grid; gap: 14px; margin: 18px auto 10px; }
.multi-grid.mode-small { grid-template-columns: repeat(6, 52px); }
.multi-grid.mode-varied { grid-template-columns: repeat(2, minmax(180px, 230px)); }
.multi-grid.mode-dbl { grid-template-columns: repeat(4, 78px); }
.mini-btn, .fire-btn, .varied-btn { position: relative; transition: .15s; }
.mini-btn {
  width: 52px; height: 52px; border-radius: 12px; border: 2px solid #94a3b8;
  background: linear-gradient(#fff, #e2e8f0); font-size: 20px; color: #64748b;
  box-shadow: 0 4px 0 #94a3b8;
}
.mini-btn:hover, .varied-btn:hover, .fire-btn:hover { transform: translateY(-3px); }
.mini-ok, .var-ok, .fire-ok {
  position: absolute; top: -8px; right: -8px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--mint); color: #fff; font-size: 14px;
  display: none; place-items: center; font-weight: 900;
}
.is-done .mini-ok, .is-done .var-ok, .is-done .fire-ok { display: grid; }
.is-done { opacity: .72; }
.varied-wrap { position: relative; display: grid; place-items: center; }
.varied-btn { padding: 14px 18px; font-weight: 900; border-radius: 12px; border: 2px solid #cbd5e1; background: #fff; }
.btn-outline { border-color: #2563eb; color: #2563eb; }
.btn-round { border-radius: 50%; width: 60px; height: 60px; background: var(--amber); color: #fff; }
.btn-wide { width: 210px; background: var(--pink); color: #fff; border: 0; }
.btn-pill { border-radius: 99px; background: var(--purple); color: #fff; border: 0; }
.btn-image-small { background: #dcfce7; border: 0; }
.btn-rainbow { background: linear-gradient(90deg,#f43f5e,#f59e0b,#22c55e); color: #fff; border: 0; }
.fire-btn { border: 0; background: transparent; padding: 0; }
.fire-btn.is-exploded svg { opacity: .18; transform: scale(.7) rotate(25deg); transition: .3s; }
.multi-count { font-weight: 800; color: var(--muted); margin: 10px 0; }
.reveal-next { margin-top: 12px; }
.pop { animation: pop .35s ease; }
@keyframes pop { 0% { transform: scale(.6); } 70% { transform: scale(1.1); } 100% { transform: scale(1); } }

/* ---------------- Прокручування ---------------- */
.scroll-hint {
  display: inline-block; background: #fef3c7; color: #92400e; font-weight: 900;
  font-size: 13px; padding: 7px 14px; border-radius: 99px; margin-bottom: 12px;
}
.scroll-box {
  border: 3px solid #cbd5e1; border-radius: 16px; background: #fff;
  height: 330px; padding: 18px; scrollbar-color: var(--purple) #ede9fe;
}
.scroll-box.dir-v { overflow-y: scroll; overflow-x: hidden; }
.scroll-box.dir-h { overflow-x: scroll; overflow-y: hidden; }
.scroll-box.dir-both { overflow: scroll; }
.scroll-inner.tall { min-height: 980px; }
.scroll-inner.wide { width: 1900px; }
.scroll-inner.huge { width: 2000px; min-height: 1100px; }
.scroll-pic { font-size: 72px; }
.scroll-inner h3 { color: var(--purple); }
.poem-author { color: var(--muted); font-style: italic; }
.scroll-inner p { line-height: 1.8; font-size: 15px; }
.wide-strip { display: flex; align-items: center; gap: 30px; height: 280px; }
.wide-strip span { font-size: 100px; }
.far-corner { margin: 700px 0 0 1600px; width: 260px; }

/* ---------------- Лабіринт ---------------- */
.maze-ex { display: flex; flex-direction: column; align-items: center; }
.maze {
  display: grid; grid-template-rows: repeat(9, 34px); margin: 10px auto;
  border: 4px solid #166534; border-radius: 12px; overflow: hidden;
}
.maze-row { display: grid; grid-template-columns: repeat(9, 34px); }
.maze-cell { font-size: 8px; display: grid; place-items: center; font-weight: 900; }
.maze-cell.wall { background: linear-gradient(135deg,#16a34a,#15803d); transition: background .12s; }
.maze-cell.wall.touched { background: #ef4444; }
.maze-cell.path { background: #fff; }
.maze-cell.path.visited { background: #dcfce7; }
.maze-cell.start { background: #fde68a; color: #92400e; }
.maze-cell.exit { background: #38bdf8; color: #fff; animation: glow 1s infinite alternate; }
@keyframes glow { from { box-shadow: inset 0 0 4px #0284c7; } to { box-shadow: inset 0 0 16px #0ea5e9; } }
.maze-tip { font-size: 13px; color: var(--muted); }

/* ---------------- Форми ---------------- */
.form-card {
  background: #faf7ff; border: 2px solid #ede9fe; border-radius: 18px;
  padding: 22px 26px; max-width: 460px; margin: 0 auto;
}
.form-kicker { font-weight: 900; color: var(--purple); margin: 0 0 16px; }
.check-row {
  display: flex; align-items: center; gap: 12px; padding: 7px 0;
  font-size: 16px; cursor: pointer;
}
.check-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-row .box {
  width: 24px; height: 24px; border-radius: 6px; border: 3px solid #a78bfa;
  background: #fff; display: grid; place-items: center; flex: 0 0 24px;
}
.check-row .dot {
  width: 24px; height: 24px; border-radius: 50%; border: 3px solid #a78bfa;
  background: #fff; display: grid; place-items: center; flex: 0 0 24px;
}
.check-row input:checked + .box { background: var(--purple); border-color: var(--purple-dark); }
.check-row input:checked + .box::after { content: '✓'; color: #fff; font-size: 16px; font-weight: 900; }
.check-row input:checked + .dot { border-color: var(--purple); }
.check-row input:checked + .dot::after { content: ''; width: 10px; height: 10px; background: var(--purple); border-radius: 50%; }
.check-row:hover .box, .check-row:hover .dot { transform: scale(1.1); }
.check-row input:focus-visible + .box, .check-row input:focus-visible + .dot { outline: 3px solid #fbcfe8; }
.select-menu {
  width: 100%; max-width: 300px; padding: 12px 14px; border-radius: 12px;
  border: 3px solid #a78bfa; background: #fff; font-size: 16px;
}
.select-list { height: 130px; }
.name-card { max-width: 380px; }
.field-label { display: block; margin: 10px 0 4px; font-size: 13px; font-weight: 900; color: var(--purple); }
.name-card input[type="text"] {
  width: 100%; padding: 10px 12px; border: 3px solid #ddd6fe;
  border-radius: 12px; font-size: 15px;
}
.name-card input[type="text"]:focus { outline: none; border-color: var(--purple); }
.hint-bar {
  margin-top: 14px; background: #fef3c7; border: 2px solid #fcd34d;
  color: #92400e; border-radius: 14px; padding: 12px 18px; font-size: 14px;
}

/* ---------------- Модалка та успіх ---------------- */
.modal-overlay, .success-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 50;
  display: grid; place-items: center; padding: 20px; backdrop-filter: blur(3px);
}
.modal, .success-card {
  background: #fff; border-radius: 24px; padding: 32px; max-width: 420px; width: 100%;
  text-align: center; box-shadow: 0 24px 70px rgba(0,0,0,.25); animation: pop .3s ease;
}
.modal-icon {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%;
  background: #fef3c7; color: #b45309; font-size: 34px; font-weight: 900;
  display: grid; place-items: center;
}
.modal h3 { margin: 0 0 8px; color: var(--purple); }
.modal p { color: var(--muted); line-height: 1.55; }
.success-card { max-width: 340px; }
.success-check { font-size: 68px; color: var(--mint); line-height: 1; }
.success-card p { font-size: 22px; font-weight: 900; color: var(--mint); margin: 8px 0 4px; }
.success-card small { color: var(--muted); }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }

/* ---------------- Фінал ---------------- */
.finish-card {
  background: #fff; border-radius: 30px; padding: 42px; box-shadow: var(--shadow);
  border: 1px solid #ede9fe;
}
.finish-top { display: flex; align-items: center; gap: 24px; margin-bottom: 28px; }
.trophy { font-size: 88px; line-height: 1; }
.finish-top h2 { margin: 0 0 8px; color: var(--purple); }
.name-form { display: grid; gap: 10px; max-width: 380px; }
.name-form label { font-weight: 800; font-size: 13px; }
.name-form input {
  padding: 12px 14px; border: 3px solid #ddd6fe; border-radius: 12px; font-size: 16px;
}
.name-form input:focus { outline: none; border-color: var(--purple); }
.name-form .btn { margin-top: 10px; }
/* ---------------- Сертифікат ---------------- */
.certificate {
  position: relative; margin: 20px auto 0; max-width: 740px; padding: 10px;
  border-radius: 10px;
  background: linear-gradient(135deg,#d4a72c,#fde68a 22%,#b8860b 50%,#fde68a 78%,#d4a72c);
  box-shadow: 0 20px 55px rgba(120,60,10,.28);
}
.cert-inner {
  position: relative; overflow: hidden; text-align: center;
  padding: 20px 34px 28px; border: 2px solid #b8860b; border-radius: 4px;
  background: #fff8e8 url('background.png') center / cover no-repeat;
}
.cert-inner::before {
  content: ''; position: absolute; inset: 7px; border: 1px solid rgba(184,134,11,.45);
  border-radius: 2px; pointer-events: none;
}
.cert-watermark {
  position: absolute; inset: 0; pointer-events: none; opacity: .04;
  background: url('mouse.png') center 45% / 280px auto no-repeat;
  transform: rotate(-12deg);
}
.cert-corner { position: absolute; width: 46px; height: 46px; z-index: 2; pointer-events: none; }
.cert-corner svg { width: 100%; height: 100%; display: block; }
.cert-corner.tl { top: 2px; left: 2px; }
.cert-corner.tr { top: 2px; right: 2px; transform: scaleX(-1); }
.cert-corner.bl { bottom: 2px; left: 2px; transform: scaleY(-1); }
.cert-corner.br { bottom: 2px; right: 2px; transform: scale(-1,-1); }
.cert-laurel-wrap { margin-bottom: -2px; }
.cert-laurel { display: block; margin: 0 auto; }
.cert-ribbon { position: relative; width: min(520px, 92%); margin: 2px auto 10px; }
.cert-ribbon img {
  display: block; width: 100%; height: auto;
  filter: drop-shadow(0 4px 7px rgba(90,50,10,.28));
}
.cert-divider {
  display: flex; align-items: center; gap: 10px; max-width: 300px;
  margin: 6px auto 0; color: #d4a72c; font-size: 13px;
}
.cert-divider::before, .cert-divider::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, #d4a72c, transparent);
}
.cert-inner h3 {
  font-family: Georgia, 'Times New Roman', serif; font-size: 44px; letter-spacing: .04em;
  margin: 2px 0 2px; color: #5b21b6; text-shadow: 0 1px 0 #fff;
}
.cert-subtitle {
  margin: 0 0 16px; font-size: 10px; font-weight: 800; letter-spacing: .2em;
  text-transform: uppercase; color: #a16207;
}
.cert-text { color: var(--muted); margin: 6px 0; }
.cert-name {
  font-family: 'Segoe Script', 'Bradley Hand', 'Comic Sans MS', cursive;
  font-size: 36px; font-weight: 700; color: #9a3412; margin: 12px 0 10px;
  display: inline-block; padding: 0 26px 7px; border-bottom: 2px solid #d4a72c;
  position: relative;
}
.cert-name::after {
  content: ''; position: absolute; left: 18%; right: 18%; bottom: -5px;
  height: 1px; background: #d4a72c; opacity: .6;
}
.cert-stats {
  display: inline-block; font-size: 12px; color: #78350f; background: #fff3c4;
  border: 1px solid #fcd34d; border-radius: 99px; padding: 6px 16px; margin: 12px 0 0;
}
.cert-bottom {
  position: relative; z-index: 1; display: flex; align-items: flex-end;
  justify-content: space-between; gap: 16px; margin-top: 26px; text-align: left;
}
.cert-label {
  display: block; font-size: 9px; letter-spacing: .12em; text-transform: uppercase;
  color: #a16207; font-weight: 800;
}
.cert-date { display: block; font-size: 14px; color: #78350f; margin-top: 3px; }
.cert-serial { display: block; font-size: 9px; color: #a16207; margin-top: 2px; font-family: monospace; }
.cert-sign-block { flex: 1; text-align: center; }
.cert-sign-script {
  font-family: 'Segoe Script', 'Bradley Hand', 'Comic Sans MS', cursive;
  font-size: 25px; font-style: italic; color: #1e3a8a; line-height: 1;
  transform: rotate(-4deg);
}
.cert-sign-line {
  width: 180px; max-width: 100%; height: 1px; background: #1e3a8a;
  margin: 5px auto 6px; opacity: .55;
}
.cert-sign-script img {
  display: block; width: 190px; max-width: 100%; height: auto;
  margin: 0 auto -4px; transform: rotate(-2deg);
}
.cert-seal-wrap {
  flex: 0 0 auto; width: 112px; transform: rotate(-9deg);
  filter: drop-shadow(0 5px 8px rgba(90,60,10,.35));
}
.cert-seal { display: block; width: 100%; height: auto; }
.finish-actions { display: flex; gap: 12px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }

/* ---------------- Адаптивність ---------------- */
@media (max-width: 900px) {
  .start-card { grid-template-columns: 1fr; text-align: center; padding: 28px; }
  .start-copy h1 { font-size: 40px; }
  .start-actions, .features { justify-content: center; }
  .stage-wrap { grid-template-columns: 1fr; }
  .mascot-panel { position: static; display: flex; align-items: center; gap: 14px; }
  .mascot-art { flex: 0 0 110px; }
  .mascot-art .gfx-mouse { width: 92px; }
  .level-grid { grid-template-columns: repeat(10, 1fr); }
  .speech { margin: 0; text-align: left; }
  .speech::before { display: none; }
  .finish-top { flex-direction: column; text-align: center; }
}
@media (max-width: 600px) {
  .app { padding: 12px 10px 40px; }
  .hud { flex-wrap: wrap; }
  .exercise { padding: 20px 16px; }
  .img-grid { grid-template-columns: repeat(2, 1fr); }
  .multi-grid.mode-small { grid-template-columns: repeat(4, 48px); }
  .multi-grid.mode-dbl { grid-template-columns: repeat(3, 70px); }
  .num-grid { grid-template-columns: repeat(3, 48px); }
  .features { grid-template-columns: 1fr; }
  .level-grid { grid-template-columns: repeat(8, 1fr); }
  .cert-inner { padding: 18px 16px 24px; }
  .cert-inner h3 { font-size: 32px; }
  .cert-name { font-size: 26px; padding: 0 12px 6px; }
  .cert-bottom { flex-wrap: wrap; justify-content: center; text-align: center; }
  .cert-seal-wrap { width: 84px; margin: 8px auto 0; }
  .cert-sign-script img { width: 150px; }
  .cert-corner { width: 32px; height: 32px; }
}

/* ---------------- Друк сертифіката ---------------- */
@media print {
  body { background: #fff; }
  .app > *:not(#finishScreen) { display: none !important; }
  .finish-top, .name-form, .finish-actions, .credits, .hud { display: none !important; }
  .finish-card { box-shadow: none; padding: 0; }
  .certificate { box-shadow: none; padding: 6px; }
  .cert-watermark { opacity: .04; }
  .cert-seal-wrap { filter: none; }
}
