/* משחקי חשבון עד 10 - עיצוב משותף לכל הדפים */
:root {
  --ink: #2b3a55;
  --muted: #5f6f8f;
  --blue: #339af0;
  --blue-dark: #1c7ed6;
  --green: #40c057;
  --red: #fa5252;
  --yellow: #ffd43b;
  --purple: #9775fa;
  --orange: #ff922b;
  --radius: 22px;
  --shadow: 0 6px 0 rgba(0, 0, 0, .07), 0 10px 24px rgba(43, 58, 85, .12);
  font-family: "Varela Round", "Arial Hebrew", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--ink);
  background: linear-gradient(180deg, #d9f0ff 0%, #fff6dc 100%) fixed;
  font-size: 18px;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 4px solid var(--blue-dark); outline-offset: 3px; }

/* ---------- עמוד ראשי ---------- */
.home { max-width: 1000px; margin: 0 auto; padding: 16px 16px 32px; text-align: center; }
.home-head { position: relative; }
.home-head h1 { font-size: clamp(34px, 8vw, 60px); margin: 8px 0 0; color: var(--blue-dark); text-shadow: 0 4px 0 #fff; }
.home-head p { margin: 2px 0 10px; font-size: clamp(18px, 4.5vw, 24px); color: var(--muted); }
.home-head .btn-icon { position: absolute; top: 4px; inset-inline-start: 0; }
.home-mascots { font-size: clamp(30px, 7vw, 44px); letter-spacing: 6px; }
@media (max-width: 600px) {
  .home-head .btn-icon { width: 44px; height: 44px; font-size: 22px; top: 0; }
  .home-mascots { min-height: 48px; }
}
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; margin-top: 18px; }
.game-card {
  --c: var(--blue);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 18px 12px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; color: var(--ink); border: 4px solid transparent; transition: transform .15s;
}
.game-card:hover, .game-card:focus-visible { transform: translateY(-4px) rotate(-1deg); border-color: var(--c); }
.game-card .gi {
  font-size: 58px; width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 22%, white);
}
.game-card b { font-size: 24px; }
.game-card small { color: var(--muted); font-size: 16px; }
.game-card:nth-child(7n+1) { --c: #339af0; }
.game-card:nth-child(7n+2) { --c: #9775fa; }
.game-card:nth-child(7n+3) { --c: #ff922b; }
.game-card:nth-child(7n+4) { --c: #f06595; }
.game-card:nth-child(7n+5) { --c: #40c057; }
.game-card:nth-child(7n+6) { --c: #fab005; }
.game-card:nth-child(7n+7) { --c: #20c997; }
.home-foot { margin-top: 26px; color: var(--muted); font-size: 15px; line-height: 2; }
.voice-check-btn {
  padding: 10px 22px; font-size: 20px; border-radius: 999px; border: 3px solid #cfe3f5; background: #fff;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .06); margin-bottom: 6px;
}
.check-result { font-weight: bold; min-height: 1.5em; }
.tips { text-align: start; font-size: 17px; line-height: 1.6; margin: 10px 0; padding-inline-start: 22px; color: var(--muted); }

/* ---------- חיבור / חיסור ---------- */
.modes { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.mode {
  display: flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px;
  border: 3px solid #cfe3f5; background: #fff; font-size: 22px; box-shadow: 0 4px 0 rgba(0, 0, 0, .06);
  transition: transform .15s;
}
.mode[aria-checked="true"] { background: var(--yellow); border-color: #f59f00; transform: scale(1.06); font-weight: bold; }

/* ---------- מסגרת המשחק ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  max-width: 900px; margin: 10px auto 0; padding: 8px 10px;
  background: rgba(255, 255, 255, .9); border-radius: var(--radius); box-shadow: var(--shadow);
}
@media (max-width: 920px) { .topbar { margin: 8px 8px 0; } }
.game-title { font-size: clamp(20px, 5.5vw, 30px); margin: 0; text-align: center; }
.btn-icon {
  width: 56px; height: 56px; flex: none; border-radius: 50%; border: none; background: #e7f5ff;
  font-size: 28px; display: grid; place-items: center; text-decoration: none; box-shadow: 0 4px 0 rgba(0, 0, 0, .08);
}
.btn-icon.small { width: 40px; height: 40px; font-size: 20px; display: inline-grid; vertical-align: middle; }
.progress { display: flex; justify-content: center; gap: 6px; margin: 10px auto 6px; flex-wrap: wrap; padding: 0 8px; }
.dot { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid #cfe3f5; transition: background .3s; }
.dot.done { background: var(--yellow); border-color: #f59f00; animation: pop .4s; }
.stage { max-width: 900px; margin: 0 auto; padding: 8px 12px 28px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; width: 100%; }
.question { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.question.compact { padding: 10px; gap: 6px; }

/* ---------- ציורים לספירה ---------- */
.pics { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.group { display: grid; grid-template-columns: repeat(var(--cols), auto); gap: 4px; padding: 8px; border-radius: 16px; background: #f1f8ff; }
.pic { font-size: clamp(28px, 7.5vw, 46px); line-height: 1; width: 1.2em; height: 1.2em; display: grid; place-items: center; position: relative; }
.pic.gone .e { opacity: .3; filter: grayscale(1); }
.pic.gone::after { content: "✕"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--red); font-weight: bold; font-size: .9em; }
.pic.ghost { border: 3px dashed #74c0fc; border-radius: 50%; color: #4dabf7; font-weight: bold; }
.pic.ghost .e { font-size: .6em; }
.pic.appear { animation: pop .4s; }
.pics-op { font-size: clamp(34px, 8vw, 48px); font-weight: bold; color: var(--orange); }
.pics.small .pic { font-size: clamp(20px, 5vw, 32px); }
.pics.small .group { padding: 5px; }
.pics.mini { gap: 4px; }
.pics.mini .group { padding: 2px; gap: 1px; background: none; }
.pics.mini .pic { font-size: clamp(12px, 3.3vw, 18px); }
.pics.mini .pics-op { font-size: 16px; }
.group.dots { background: none; padding: 0; gap: 2px; }
.group.dots .pic { font-size: clamp(14px, 4vw, 22px); color: var(--blue); }

/* ---------- תרגיל כתוב ---------- */
.eq { display: flex; align-items: center; justify-content: center; gap: .25em; font-size: clamp(42px, 11vw, 72px); font-weight: bold; line-height: 1.2; }
.eq .sym { color: var(--orange); }
.eq .box {
  min-width: 1.2em; height: 1.2em; padding: 0 .1em; border: 4px dashed #74c0fc; border-radius: 16px;
  display: grid; place-items: center; color: #74c0fc;
}
.eq .box.filled { border-style: solid; border-color: var(--green); color: var(--green); background: #ebfbee; animation: pop .4s; }
.eq .crossed { text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 6px; opacity: .45; }
.eq .fixed { color: var(--green); animation: pop .4s; }
.eq.small { font-size: clamp(20px, 5vw, 28px); gap: .15em; }

/* ---------- כפתורי תשובה ---------- */
.answers { display: flex; justify-content: center; gap: clamp(14px, 5vw, 32px); flex-wrap: wrap; }
.answer {
  width: clamp(86px, 25vw, 124px); aspect-ratio: 1; border-radius: 50%; border: none;
  font-size: clamp(42px, 12vw, 62px); font-weight: bold; color: #fff;
  box-shadow: 0 7px 0 rgba(0, 0, 0, .18); transition: transform .1s, box-shadow .1s;
}
.answer.c0 { background: var(--blue); }
.answer.c1 { background: var(--purple); }
.answer.c2 { background: var(--orange); }
.answer:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 3px 0 rgba(0, 0, 0, .18); }
.answer.wrong { background: #ced4da; animation: shake .4s; }
.answer.right { background: var(--green); animation: bounce .6s; }

/* ---------- נכון או לא נכון ---------- */
.tf-row { display: flex; gap: 16px; justify-content: center; width: 100%; }
.tf {
  flex: 1; max-width: 260px; padding: 14px; border: none; border-radius: var(--radius);
  font-size: clamp(24px, 6vw, 32px); font-weight: bold; color: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: 0 7px 0 rgba(0, 0, 0, .18);
}
.tf-icon { font-size: 50px; }
.tf.yes { background: var(--green); }
.tf.no { background: var(--red); }
.tf.wrong { filter: grayscale(1); opacity: .5; animation: shake .4s; }
.tf.right { animation: bounce .6s; outline: 6px solid var(--yellow); }

/* ---------- התאמה ---------- */
.match { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; width: 100%; align-items: start; }
.col { display: flex; flex-direction: column; gap: 10px; }
.match-arrow { align-self: center; font-size: 30px; color: var(--muted); }
.tile {
  background: #fff; border-radius: 18px; box-shadow: var(--shadow); min-height: 86px; padding: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 4px solid transparent; transition: transform .15s;
}
.ex-tile { touch-action: none; user-select: none; -webkit-user-select: none; }
.ans-tile { font-size: clamp(38px, 10vw, 50px); font-weight: bold; color: var(--blue-dark); }
.tile.selected { border-color: #f59f00; background: #fff9db; transform: scale(1.03); }
.tile.matched { border-color: var(--pair); background: color-mix(in srgb, var(--pair) 20%, white); cursor: default; }
.tile.wrong { animation: shake .4s; }
.tile.hint { animation: glow .9s 2; }
.drag-ghost { position: fixed; z-index: 50; pointer-events: none; opacity: .92; rotate: -3deg; margin: 0; }

/* ---------- זיכרון ---------- */
.memory { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; max-width: 680px; }
@media (max-width: 560px) { .memory { grid-template-columns: repeat(3, 1fr); } }
.mcard { border: none; padding: 0; background: none; aspect-ratio: 1; perspective: 800px; }
.mcard-inner { display: block; position: relative; width: 100%; height: 100%; transition: transform .45s; transform-style: preserve-3d; }
.mcard.open .mcard-inner { transform: rotateY(180deg); }
.mcard-back, .mcard-front {
  position: absolute; inset: 0; border-radius: 16px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); overflow: hidden;
}
.mcard-back { background: repeating-linear-gradient(45deg, #74c0fc 0 12px, #4dabf7 12px 24px); color: #fff; font-size: 48px; font-weight: bold; }
.mcard-front { background: #fff; transform: rotateY(180deg); border: 4px solid transparent; padding: 4px; }
.mcard.matched .mcard-front { border-color: var(--pair); background: color-mix(in srgb, var(--pair) 20%, white); }
.face-ex, .face-ans { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.big-num { font-size: clamp(36px, 9vw, 52px); font-weight: bold; color: var(--blue-dark); line-height: 1; }

/* ---------- בלונים ---------- */
.sky {
  position: relative; width: 100%; height: 420px; overflow: hidden; border-radius: var(--radius);
  background: linear-gradient(#a5d8ff, #e7f5ff); box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .7);
}
.balloon {
  position: absolute; left: 0; top: 0; border: none; padding: 0; color: #fff; font-weight: bold;
  border-radius: 50% 50% 48% 52% / 55% 55% 45% 45%; display: grid; place-items: center;
  box-shadow: inset -8px -10px 0 rgba(0, 0, 0, .12), inset 6px 8px 0 rgba(255, 255, 255, .25);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .25); touch-action: manipulation;
}
.balloon::after { content: ""; position: absolute; top: 100%; left: 50%; width: 2px; height: 42px; background: rgba(0, 0, 0, .25); }
.balloon.wobble { animation: wobble .5s; }
.balloon.popped { animation: popped .3s forwards; pointer-events: none; }
.balloon.fade { transition: opacity .4s; opacity: 0; pointer-events: none; }

/* ---------- צפרדע ---------- */
.frog-dir { font-size: clamp(20px, 5vw, 26px); color: var(--muted); }
.pond { width: 100%; background: linear-gradient(#a5d8ff, #74c0fc); border-radius: var(--radius); padding: 80px 6px 18px; box-shadow: var(--shadow); }
.numline { position: relative; display: flex; }
.pad {
  flex: 1 1 0; min-width: 0; aspect-ratio: 1; border: none; background: none; padding: 0; position: relative; z-index: 0;
  font-size: clamp(14px, 3.8vw, 28px); font-weight: bold; color: #fff; display: grid; place-items: center;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .25);
}
.pad::before { content: ""; position: absolute; inset: 6%; border-radius: 50%; background: #51cf66; box-shadow: 0 4px 0 #2f9e44; z-index: -1; }
.pad.start::before { background: #fab005; box-shadow: 0 4px 0 #e67700; }
.pad.visited::before { background: #94d82d; }
.pad.right { color: var(--ink); animation: bounce .6s; }
.pad.right::before { background: var(--yellow); box-shadow: 0 4px 0 #f59f00; }
.pad.wrong { animation: shake .4s; }
.pad.hint { animation: glow .9s infinite; }
.frog {
  position: absolute; bottom: 100%; translate: -50% 0; margin-bottom: -8px; z-index: 2;
  font-size: clamp(36px, 9vw, 60px); line-height: 1; border: none; background: none; padding: 0; transition: left .4s ease-in-out;
}
.frog.hop { animation: hop .45s ease-in-out; }

/* ---------- חלון פתיחה / סיום ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px;
  background: rgba(28, 126, 214, .35); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.overlay-card {
  background: #fff; border-radius: 28px; padding: 22px 20px; max-width: 520px; width: 100%; max-height: 100%; overflow: auto;
  text-align: center; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); animation: pop .35s;
}
.big-icon { font-size: 72px; line-height: 1.1; }
.overlay-card h2 { font-size: 34px; margin: 4px 0; }
.overlay-card p { font-size: 21px; line-height: 1.5; margin: 8px 0; }
.btn-start {
  margin-top: 12px; padding: 14px 34px; font-size: 28px; font-weight: bold; color: #fff;
  background: var(--green); border: none; border-radius: 999px; box-shadow: 0 6px 0 #2b8a3e;
}
.btn-secondary {
  display: inline-block; margin-top: 12px; padding: 14px 26px; font-size: 24px; color: var(--ink); border: none;
  background: #e7f5ff; border-radius: 999px; text-decoration: none; box-shadow: 0 6px 0 #a5d8ff;
}
.row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; align-items: center; }
.stars { font-size: 48px; letter-spacing: 6px; animation: bounce 1s; }

/* ---------- הודעה כשאין קול ---------- */
.voice-note { background: #fff3bf; color: #5c3c00; padding: 10px 14px; text-align: center; font-size: 17px; border-bottom: 3px solid var(--yellow); }

/* ---------- קונפטי ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti span { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation-name: fall; animation-timing-function: linear; animation-fill-mode: forwards; }

/* ---------- אנימציות ---------- */
@keyframes pop { 0% { scale: .6; opacity: 0; } 70% { scale: 1.1; opacity: 1; } 100% { scale: 1; } }
@keyframes shake { 0%, 100% { translate: 0; } 20%, 60% { translate: -8px 0; } 40%, 80% { translate: 8px 0; } }
@keyframes bounce { 0%, 100% { scale: 1; } 30% { scale: 1.18; } 60% { scale: .95; } }
@keyframes glow { 0%, 100% { box-shadow: var(--shadow); } 50% { box-shadow: 0 0 0 6px var(--yellow), var(--shadow); } }
@keyframes wobble { 0%, 100% { rotate: 0deg; } 25% { rotate: -14deg; } 75% { rotate: 14deg; } }
@keyframes popped { to { scale: 1.7; opacity: 0; } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-46px) rotate(-10deg); } }
@keyframes fall { to { top: 105%; rotate: 540deg; } }
.pad.hint::before, .pad.hint { border-radius: 50%; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
