/* ===== קוראים בכיף — עיצוב ===== */
@font-face {
  font-family: 'Varela Round';
  src: url('fonts/varela-he.woff2') format('woff2');
  font-weight: 400; font-display: swap;
  unicode-range: U+0590-05FF, U+FB1D-FB4F;
}
@font-face {
  font-family: 'Varela Round';
  src: url('fonts/varela-latin.woff2') format('woff2');
  font-weight: 400; font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F;
}
@font-face {
  font-family: 'Rubik';
  src: url('fonts/rubik700-he.woff2') format('woff2');
  font-weight: 700 900; font-display: swap;
  unicode-range: U+0590-05FF, U+FB1D-FB4F;
}
@font-face {
  font-family: 'Rubik';
  src: url('fonts/rubik700-latin.woff2') format('woff2');
  font-weight: 700; font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F;
}

:root {
  --ink: #43275e;
  --ink-soft: #6d5390;
  --paper: #fff8ef;
  --card: #ffffff;
  --peach: linear-gradient(135deg, #ff9e7d, #ff6b9d);
  --sunny: linear-gradient(135deg, #ffd36e, #ff9f43);
  --mint:  linear-gradient(135deg, #8ce8b0, #35b989);
  --sky:   linear-gradient(135deg, #8ec5ff, #5e8ce6);
  --lav:   linear-gradient(135deg, #d3aefc, #9b6dd6);
  --r-lg: 28px;
  --r-md: 20px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { direction: rtl; }
body {
  font-family: 'Varela Round', 'Rubik', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* רקע חי */
.blob { position: fixed; border-radius: 50%; filter: blur(70px); opacity: .45; z-index: -1; animation: drift 18s ease-in-out infinite alternate; }
.blob.b1 { width: 46vw; height: 46vw; background: #ffd9c4; top: -12vw; right: -10vw; }
.blob.b2 { width: 40vw; height: 40vw; background: #d6ecff; bottom: -14vw; left: -8vw; animation-delay: -6s; }
.blob.b3 { width: 30vw; height: 30vw; background: #e9dcff; top: 40%; left: 30%; animation-delay: -12s; }
@keyframes drift { from { transform: translate(0,0) scale(1);} to { transform: translate(4vw,3vh) scale(1.12);} }

.pointed { font-family: 'Rubik', 'Varela Round', sans-serif; font-weight: 700; }

#app { max-width: 860px; margin: 0 auto; padding: 18px 18px 60px; }
.screen { display: none; animation: screenIn .35s ease; }
.screen.on { display: block; }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px);} to { opacity: 1; transform: none;} }

/* כותרת עליונה */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stars-pill {
  background: #fff; border-radius: 999px; padding: 8px 18px;
  font-size: 20px; font-weight: 700; box-shadow: 0 4px 0 #efe3d3;
  display: flex; align-items: center; gap: 6px;
}
.icon-btn {
  border: none; background: #fff; width: 52px; height: 52px; border-radius: 18px;
  font-size: 24px; cursor: pointer; box-shadow: 0 4px 0 #efe3d3;
  transition: transform .12s;
  font-family: inherit; color: var(--ink);
}
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #efe3d3; }

.hero { text-align: center; margin: 26px 0 8px; }
.hero h1 {
  font-size: clamp(44px, 9vw, 72px); margin: 0; line-height: 1.05;
  background: linear-gradient(120deg, #ff6b9d, #ff9f43 40%, #35b989 75%, #5e8ce6);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--ink-soft); font-size: clamp(17px, 3.4vw, 22px); margin: 10px 0 0; }

/* מסלול העולמות */
.path { display: flex; flex-direction: column; gap: 22px; margin-top: 34px; }
.world {
  position: relative; border: none; cursor: pointer; text-align: start;
  background: var(--card); border-radius: var(--r-lg); padding: 20px 22px;
  display: flex; align-items: center; gap: 18px;
  box-shadow: 0 6px 0 rgba(67,39,94,.08), 0 14px 30px rgba(67,39,94,.07);
  transition: transform .15s; font-family: inherit; color: var(--ink);
}
.world:active { transform: scale(.985); }
.world .num {
  flex: 0 0 auto; width: 74px; height: 74px; border-radius: 24px;
  display: grid; place-items: center; font-size: 40px;
  box-shadow: inset 0 -6px 0 rgba(0,0,0,.12);
}
.world.l1 .num { background: var(--peach); } .world.l2 .num { background: var(--sunny); }
.world.l3 .num { background: var(--mint); }  .world.l4 .num { background: var(--sky); }
.world.l5 .num { background: var(--lav); }
.world .w-title { font-size: clamp(22px, 4.6vw, 28px); font-weight: 700; }
.world .w-sub { color: var(--ink-soft); font-size: 15px; margin-top: 4px; }
.world .w-stars { margin-inline-start: auto; font-size: 20px; letter-spacing: 2px; white-space: nowrap; }

.parents-note {
  margin-top: 40px; background: #fff; border-radius: var(--r-md); padding: 16px 20px;
  color: var(--ink-soft); font-size: 14.5px; line-height: 1.7; box-shadow: 0 4px 0 #efe3d3;
}
.parents-note b { color: var(--ink); }

/* מסך שלב */
.level-head { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.level-head h2 { font-size: clamp(30px, 6.5vw, 42px); margin: 0; }
.games-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 24px; }
@media (min-width: 620px) { .games-grid { grid-template-columns: 1fr 1fr; } }
.game-card {
  border: none; cursor: pointer; text-align: start; font-family: inherit; color: var(--ink);
  background: var(--card); border-radius: var(--r-lg); padding: 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: 0 6px 0 rgba(67,39,94,.08), 0 10px 24px rgba(67,39,94,.06);
  transition: transform .15s;
}
.game-card:active { transform: scale(.98); }
.game-card .g-ico {
  flex: 0 0 auto; width: 64px; height: 64px; border-radius: 20px; font-size: 32px;
  display: grid; place-items: center; box-shadow: inset 0 -5px 0 rgba(0,0,0,.1);
}
.game-card .g-name { font-size: 21px; font-weight: 700; }
.game-card .g-desc { color: var(--ink-soft); font-size: 14px; margin-top: 3px; }
.game-card .g-stars { margin-inline-start: auto; font-size: 18px; white-space: nowrap; }

/* אזור משחק */
.game-wrap { margin-top: 10px; }
.game-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.progress-dots { display: flex; gap: 6px; justify-content: center; margin: 12px 0 18px; }
.progress-dots .dot { width: 12px; height: 12px; border-radius: 50%; background: #ead9c8; transition: all .25s; }
.progress-dots .dot.done { background: #35b989; transform: scale(1.15); }
.progress-dots .dot.now { background: #ff9f43; transform: scale(1.3); }

.prompt-card {
  background: #fff; border-radius: var(--r-lg); padding: 26px 20px; text-align: center;
  box-shadow: 0 6px 0 rgba(67,39,94,.08), 0 14px 30px rgba(67,39,94,.07);
  margin-bottom: 22px; position: relative;
}
.prompt-label { color: var(--ink-soft); font-size: 17px; }
.prompt-big { font-size: clamp(64px, 17vw, 110px); line-height: 1.25; font-weight: 900; }
.prompt-word { font-size: clamp(44px, 11vw, 76px); line-height: 1.4; font-weight: 700; }
.replay-btn {
  border: none; cursor: pointer; font-family: inherit; color: var(--ink);
  background: var(--sky); color: #fff; font-size: 19px; font-weight: 700;
  border-radius: 999px; padding: 13px 28px; box-shadow: 0 5px 0 #4a6fc0;
  transition: transform .12s; display: inline-flex; align-items: center; gap: 8px;
}
.replay-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #4a6fc0; }

.options-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
.options-grid.cols3 { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 620px) {
  .options-grid { grid-template-columns: repeat(3, 1fr); }
  .options-grid.cols3 { grid-template-columns: repeat(3, 1fr); }
}
.opt {
  border: none; cursor: pointer; font-family: inherit; color: var(--ink);
  background: #fff; border-radius: var(--r-lg); padding: 18px 8px;
  font-size: clamp(46px, 11vw, 72px); font-weight: 700; line-height: 1.3;
  box-shadow: 0 6px 0 rgba(67,39,94,.1);
  transition: transform .12s, box-shadow .12s, opacity .2s;
}
.opt:active { transform: scale(.96); }
.opt .opt-sub { display: block; font-size: 15px; font-weight: 400; color: var(--ink-soft); margin-top: 2px; }
.opt.correct { background: #d9ffe9; box-shadow: 0 6px 0 #35b989; animation: popCorrect .5s; }
.opt.wrong { background: #ffe3e3; opacity: .5; animation: shake .4s; pointer-events: none; }
@keyframes popCorrect { 0%{transform:scale(1)} 40%{transform:scale(1.12) rotate(2deg)} 100%{transform:scale(1)} }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-8px)} 75%{transform:translateX(8px)} }

/* זיכרון */
.mem-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (min-width: 620px) { .mem-grid { grid-template-columns: repeat(4, 1fr); } }
.mem-card {
  aspect-ratio: 1; border: none; cursor: pointer; border-radius: var(--r-md);
  background: var(--sky); font-size: clamp(34px, 9vw, 52px); font-weight: 700;
  color: transparent; font-family: 'Rubik', sans-serif;
  box-shadow: 0 5px 0 rgba(67,39,94,.12); transition: all .25s; position: relative;
}
.mem-card::after { content: '❔'; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: .6em; }
.mem-card.up { background: #fff; color: var(--ink); }
.mem-card.up::after { display: none; }
.mem-card.matched { background: #d9ffe9; color: var(--ink); pointer-events: none; animation: popCorrect .5s; }
.mem-card.matched::after { display: none; }

/* טבלת ניקוד */
.nikud-tabs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 18px; }
.nikud-tab {
  border: none; cursor: pointer; font-family: 'Rubik', sans-serif; font-weight: 700;
  background: #fff; border-radius: 16px; padding: 8px 16px; font-size: 30px;
  box-shadow: 0 4px 0 rgba(67,39,94,.1); color: var(--ink); transition: all .15s;
}
.nikud-tab.sel { background: var(--mint); color: #fff; transform: scale(1.08); }
.combo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (min-width: 620px) { .combo-grid { grid-template-columns: repeat(6, 1fr); } }
.combo-cell {
  border: none; cursor: pointer; background: #fff; border-radius: 18px;
  font-family: 'Rubik', sans-serif; font-weight: 700; font-size: clamp(30px, 8vw, 44px);
  padding: 10px 0; color: var(--ink); box-shadow: 0 4px 0 rgba(67,39,94,.1);
  transition: transform .1s;
}
.combo-cell:active { transform: scale(.92); background: #f0fff7; }
.combo-cell.pulse { animation: popCorrect .45s; background: #d9ffe9; }

/* בניית הברה */
.build-area { display: flex; gap: 12px; justify-content: center; margin: 18px 0; min-height: 96px; }
.build-slot {
  min-width: 100px; border: 3px dashed #d9c8ec; border-radius: var(--r-md);
  display: grid; place-items: center; font-size: 46px; font-weight: 700;
  font-family: 'Rubik', sans-serif; background: #fff; padding: 6px 16px;
}
.build-slot.filled { border-style: solid; border-color: #35b989; background: #f0fff7; }
.parts-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.part-btn {
  border: none; cursor: pointer; font-family: 'Rubik', sans-serif; font-weight: 700;
  background: #fff; border-radius: var(--r-md); padding: 14px 26px; font-size: 44px;
  color: var(--ink); box-shadow: 0 5px 0 rgba(67,39,94,.1); transition: transform .12s;
}
.part-btn:active { transform: scale(.94); }
.part-btn.used { opacity: .25; pointer-events: none; }
.part-btn.wrong { background: #ffe3e3; animation: shake .4s; }

/* הברות במילה */
.syl-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 20px 0; }
.syl-chip {
  border: none; cursor: pointer; font-family: 'Rubik', sans-serif; font-weight: 700;
  background: #fff; border-radius: 18px; padding: 12px 22px; font-size: 40px;
  color: var(--ink); box-shadow: 0 5px 0 rgba(67,39,94,.1); transition: all .15s;
}
.syl-chip.read { background: var(--sunny); color: #fff; animation: popCorrect .4s; }

/* מירוץ */
.timer-bar { height: 16px; background: #ead9c8; border-radius: 999px; overflow: hidden; margin: 10px 0 18px; }
.timer-fill { height: 100%; background: linear-gradient(90deg, #35b989, #ff9f43); border-radius: 999px; transition: width 1s linear; }
.score-pill { background:#fff; border-radius:999px; padding:8px 18px; font-size:19px; font-weight:700; box-shadow: 0 4px 0 #efe3d3; }
.streak { color: #ff6b35; font-weight: 700; font-size: 18px; min-height: 24px; text-align: center; }

/* מסך ניצחון */
.win-overlay {
  position: fixed; inset: 0; background: rgba(67,39,94,.45); z-index: 50;
  display: none; place-items: center; backdrop-filter: blur(4px);
}
.win-overlay.on { display: grid; }
.win-card {
  background: var(--paper); border-radius: 34px; padding: 36px 30px; text-align: center;
  max-width: 340px; width: calc(100% - 48px); animation: winIn .45s cubic-bezier(.2,1.4,.4,1);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
@keyframes winIn { from { transform: scale(.6) translateY(40px); opacity: 0;} to { transform: none; opacity: 1;} }
.win-card .win-stars { font-size: 54px; letter-spacing: 6px; }
.win-card .win-stars .dim { filter: grayscale(1); opacity: .3; }
.win-card h3 { font-size: 30px; margin: 12px 0 4px; }
.win-card p { color: var(--ink-soft); margin: 0 0 20px; font-size: 17px; }
.win-btns { display: flex; gap: 10px; justify-content: center; }
.big-btn {
  border: none; cursor: pointer; font-family: inherit; font-weight: 700; font-size: 19px;
  border-radius: 999px; padding: 14px 26px; color: #fff; transition: transform .12s;
}
.big-btn.again { background: var(--sunny); box-shadow: 0 5px 0 #d17f2a; }
.big-btn.homeb { background: var(--lav); box-shadow: 0 5px 0 #7a4fb5; }
.big-btn:active { transform: translateY(3px); }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
