:root {
  --sea: #2a9aa8; --sea-d: #1f7783; --deep: #1c3b73; --blue: #4a72c4; --blue-l: #dde7f5;
  --hib: #d9628a; --hib-l: #f6e1e8; --sun: #e0a526; --sun-l: #f6ecd0; --leaf: #3a9e6b; --leaf-l: #dcefe3;
  --bad: #d9695d; --bad-l: #f6e1de; --ink: #1d3557; --muted: #5f7189; --card: #f8f5ecee;
  --r: 24px; --shadow: 0 8px 0 rgba(11, 61, 145, .12), 0 14px 30px rgba(11, 61, 145, .14);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); direction: rtl;
  font-family: "Segoe UI", "Arial Rounded MT Bold", "Heebo", system-ui, Arial, sans-serif; font-size: 18px; line-height: 1.5;
  background: linear-gradient(180deg, #8fc3cc 0%, #bcd9d9 40%, #e7dfc9 100%) fixed; overflow-x: hidden;
}
.sun { position: fixed; top: -50px; left: -40px; width: 190px; height: 190px; border-radius: 50%;
  background: radial-gradient(circle, #f0d68a 30%, #e0a52655 70%, transparent 72%); z-index: 0; animation: pulse 6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.waves { position: fixed; bottom: 0; left: 0; width: 100%; height: 130px; z-index: 4; pointer-events: none; overflow: hidden; }
.waves .layer { position: absolute; left: 0; bottom: 0; width: 100%; height: 190px; animation: bob ease-in-out infinite alternate; }
.waves .layer svg { position: absolute; left: 0; bottom: 0; width: 200%; height: 100%; }
.waves .layer:nth-child(odd) { animation-direction: alternate-reverse; }
@keyframes slide { to { transform: translateX(-50%); } }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(9px); } }
.waves .boat { position: absolute; bottom: 70px; width: 64px; height: 64px; left: -80px; animation: sail 70s linear infinite, tilt 4s ease-in-out infinite alternate; }
.waves .boat svg { width: 100%; height: 100%; }
@keyframes sail { to { left: 110%; } }
@keyframes tilt { from { rotate: -4deg; translate: 0 2px; } to { rotate: 4deg; translate: 0 -4px; } }
.waves .glit { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #fff; box-shadow: 0 0 8px 3px #fff9; opacity: 0; z-index: 9; animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.4); } 50% { opacity: .95; transform: scale(1); } }
.petals { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.petal { position: absolute; top: -40px; font-size: 22px; opacity: .8; animation: fall linear infinite; }
@keyframes fall { to { transform: translateY(110vh) rotate(360deg); } }

#app { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; padding: 14px 16px 170px; }
h1, h2, h3 { margin: .2em 0; line-height: 1.2; }
h1 { font-size: 2rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.2rem; }
.muted { color: var(--muted); }
.card { background: var(--card); border: 3px solid #fff; border-radius: var(--r); padding: 18px; margin: 14px 0; box-shadow: var(--shadow); backdrop-filter: blur(4px); }
.card.sun-c { background: var(--sun-l); } .card.hib-c { background: var(--hib-l); } .card.leaf-c { background: var(--leaf-l); } .card.blue-c { background: var(--blue-l); }

.top { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 4px; }
.back { border: 0; background: #fff; color: var(--deep); font: inherit; font-weight: 700; border-radius: 999px; padding: 8px 16px; box-shadow: 0 4px 0 rgba(11,61,145,.15); cursor: pointer; }
.pill { background: #fff; border-radius: 999px; padding: 6px 14px; font-weight: 700; box-shadow: 0 4px 0 rgba(11,61,145,.12); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; font: inherit; font-weight: 800;
  color: #fff; background: var(--blue); border-radius: 18px; padding: 12px 22px; box-shadow: 0 6px 0 #35569a; transition: transform .08s, box-shadow .08s; }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #35569a; }
.btn.hib { background: var(--hib); box-shadow: 0 6px 0 #a84668; } .btn.hib:active { box-shadow: 0 2px 0 #a84668; }
.btn.leaf { background: var(--leaf); box-shadow: 0 6px 0 #2a7a50; } .btn.leaf:active { box-shadow: 0 2px 0 #2a7a50; }
.btn.sun { background: var(--sun); color: #5a3a00; box-shadow: 0 6px 0 #a8801a; } .btn.sun:active { box-shadow: 0 2px 0 #a8801a; }
.btn.ghost { background: #fff; color: var(--deep); box-shadow: 0 6px 0 rgba(11,61,145,.18); }
.btn.big { font-size: 1.15rem; padding: 14px 26px; width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.center { justify-content: center; }

/* hero */
.hero { display: flex; align-items: center; gap: 12px; }
.hero .txt { flex: 1; }
.mascot { width: 130px; flex: none; animation: bob 3s ease-in-out infinite; transform-origin: bottom center; }
.mascot.sm { width: 64px; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(2deg); } }
.bubble { background: #fff; border-radius: 18px; padding: 10px 14px; font-weight: 600; position: relative; box-shadow: 0 4px 0 rgba(11,61,145,.1); }
.countdown { display: inline-block; background: var(--hib); color: #fff; font-weight: 800; border-radius: 999px; padding: 4px 14px; margin-top: 6px; animation: pulse 2s infinite; }
.progress { height: 18px; border-radius: 999px; background: #fff; overflow: hidden; box-shadow: inset 0 2px 4px rgba(0,0,0,.12); }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--sea), var(--leaf), var(--sun)); border-radius: 999px; transition: width .5s; }

/* island map */
.map { display: grid; gap: 14px; margin-top: 10px; }
.stop { display: flex; align-items: center; gap: 14px; background: var(--card); border: 3px solid #fff; border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); cursor: pointer; text-align: right; font: inherit; color: inherit; width: 100%; transition: transform .12s; }
.stop:hover { transform: translateY(-3px) rotate(-.4deg); }
.stop .ic { width: 62px; height: 62px; border-radius: 20px; display: grid; place-items: center; font-size: 2rem; flex: none; background: var(--blue-l); }
.stop:nth-child(2) .ic { background: var(--leaf-l); } .stop:nth-child(3) .ic { background: var(--sun-l); } .stop:nth-child(4) .ic { background: var(--hib-l); }
.stop:nth-child(5) .ic { background: #e4e0f2; } .stop:nth-child(6) .ic { background: #f3e4d4; }
.stop b { font-size: 1.15rem; display: block; } .stop small { color: var(--muted); }
.stars { letter-spacing: 2px; white-space: nowrap; }
.stars .off { filter: grayscale(1); opacity: .3; }
.finalstop { background: linear-gradient(135deg, #c9567f, #d79a2b); color: #fff; }
.finalstop small { color: #fff; opacity: .95; } .finalstop .ic { background: #ffffff55 !important; }

/* choice lists */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 460px) { .grid2 { grid-template-columns: 1fr; } .mascot { width: 100px; } h1 { font-size: 1.6rem; } }
.tile-btn { background: #fff; border: 3px solid #fff; border-radius: 20px; padding: 14px; font: inherit; color: inherit; box-shadow: var(--shadow); cursor: pointer; text-align: right; }
.tile-btn:hover { border-color: var(--sea); }
.tile-btn .ic { font-size: 1.8rem; }

/* quiz */
.qhead { display: flex; align-items: center; gap: 10px; }
.qhead .progress { flex: 1; }
.qcard { text-align: center; }
.ask { color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.qtext { font-size: 1.7rem; font-weight: 800; margin: 6px 0 12px; }
.qtext.en { direction: ltr; }
.opts { display: grid; gap: 10px; margin-top: 10px; }
.opt { border: 3px solid #cbd7ea; background: #fdfbf5; border-radius: 18px; padding: 13px 14px; font: inherit; font-weight: 700; color: var(--ink); cursor: pointer; box-shadow: 0 4px 0 #cbd7ea; }
.opt:hover:not(:disabled) { border-color: var(--blue); }
.opt.right { background: var(--leaf-l); border-color: var(--leaf); box-shadow: 0 4px 0 var(--leaf); animation: pop .35s; }
.opt.wrong { background: var(--bad-l); border-color: var(--bad); box-shadow: 0 4px 0 var(--bad); animation: shake .35s; }
@keyframes pop { 50% { transform: scale(1.06); } }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.fb { margin-top: 14px; padding: 12px 14px; border-radius: 18px; font-weight: 700; text-align: right; }
.fb.ok { background: var(--leaf-l); color: #0d6b36; } .fb.bad { background: var(--bad-l); color: #a5281c; }
input.txt, textarea.txt { width: 100%; font: inherit; font-size: 1.3rem; padding: 12px 14px; border-radius: 16px; border: 3px solid #cfe0ff; background: #fff; color: var(--ink); direction: ltr; text-align: left; }
textarea.txt { min-height: 140px; resize: vertical; font-size: 1.15rem; }
input.txt:focus, textarea.txt:focus { outline: 0; border-color: var(--blue); }
.line { min-height: 62px; border-radius: 18px; background: #fff; border: 3px dashed #b9cff7; padding: 8px; display: flex; flex-wrap: wrap; gap: 8px; direction: ltr; justify-content: flex-start; align-content: flex-start; }
.bank { display: flex; flex-wrap: wrap; gap: 8px; direction: ltr; margin-top: 12px; justify-content: center; }
.chip { border: 0; border-radius: 14px; padding: 9px 14px; font: inherit; font-size: 1.15rem; font-weight: 800; background: var(--sun); color: #5a3a00; box-shadow: 0 4px 0 #a8801a; cursor: pointer; }
.chip.used { visibility: hidden; }
.line .chip { background: var(--blue); color: #fff; box-shadow: 0 4px 0 #35569a; }
.say { border: 0; border-radius: 50%; width: 48px; height: 48px; font-size: 1.4rem; background: var(--sea); color: #fff; box-shadow: 0 4px 0 var(--sea-d); cursor: pointer; flex: none; }
.say.slow { background: var(--hib); box-shadow: 0 4px 0 #a84668; }
.passage { text-align: left; direction: ltr; font-size: 1.15rem; background: #fff; border-radius: 18px; padding: 14px; line-height: 1.7; }
.passage-box summary { cursor: pointer; font-weight: 800; }

/* flashcard */
.flip { perspective: 900px; height: 230px; margin: 14px 0; cursor: pointer; }
.flip-in { position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d; }
.flip.on .flip-in { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: var(--r); display: grid; place-items: center; text-align: center; padding: 16px; box-shadow: var(--shadow); border: 3px solid #fff; }
.face.f { background: linear-gradient(135deg, #4a72c4, #2a9aa8); color: #fff; }
.face.b { background: linear-gradient(135deg, #d79a2b, #c9567f); color: #fff; transform: rotateY(180deg); }
.face .big { font-size: 2.2rem; font-weight: 800; direction: ltr; }
.face .he { font-size: 2rem; font-weight: 800; }
.face .ex { direction: ltr; margin-top: 8px; font-size: 1.1rem; opacity: .95; }
.face .hint { position: absolute; bottom: 10px; font-size: .85rem; opacity: .8; }

/* memory */
.mem { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 560px) { .mem { grid-template-columns: repeat(4, 1fr); } }
.mcard { aspect-ratio: 1 / .85; border: 0; border-radius: 18px; font: inherit; font-weight: 800; font-size: 1rem; cursor: pointer; background: linear-gradient(135deg, var(--sea), var(--blue)); color: #fff; box-shadow: 0 5px 0 #35569a; padding: 4px; line-height: 1.2; }
.mcard.up { background: #fff; color: var(--ink); box-shadow: 0 5px 0 #cfe0ff; }
.mcard.up.en { direction: ltr; }
.mcard.done { background: var(--leaf-l); color: #0d6b36; box-shadow: 0 5px 0 var(--leaf); animation: pop .4s; }

/* grammar */
.gtable { width: 100%; border-collapse: separate; border-spacing: 0 8px; direction: ltr; font-size: 1.3rem; font-weight: 800; }
.gtable td { background: #fff; padding: 12px 14px; }
.gtable td:first-child { border-radius: 16px 0 0 16px; } .gtable td:last-child { border-radius: 0 16px 16px 0; color: #fff; text-align: center; }
.gtable tr:nth-child(1) td:last-child { background: var(--blue); } .gtable tr:nth-child(2) td:last-child { background: var(--hib); } .gtable tr:nth-child(3) td:last-child { background: var(--leaf); }
.form3 { display: grid; gap: 10px; direction: ltr; }
.form3 div { background: #fff; border-radius: 16px; padding: 10px 14px; font-size: 1.2rem; font-weight: 700; display: flex; gap: 10px; align-items: center; }
.form3 b.s { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }
.s.p { background: var(--leaf); } .s.n { background: var(--bad); } .s.q { background: var(--blue); }
.he-note { direction: rtl; font-weight: 600; font-size: .95rem; color: var(--muted); margin-inline-start: auto; }

/* result */
.result { text-align: center; }
.bigstars { font-size: 3rem; letter-spacing: 6px; }
.bigstars .off { filter: grayscale(1); opacity: .25; }
.mistake { text-align: right; background: #fff; border-radius: 14px; padding: 8px 12px; margin: 6px 0; }
.mistake .en { direction: ltr; display: inline-block; font-weight: 800; color: var(--deep); }
.confetti { position: fixed; top: -30px; font-size: 26px; z-index: 50; pointer-events: none; animation: fall 2.6s ease-in forwards; }
.cert { text-align: center; border: 6px double var(--sun); background: #fffdf3; }
.cert h1 { color: var(--hib); }
.note { font-size: .95rem; color: var(--muted); }
.good { color: #0d6b36; } .bad-t { color: #a5281c; }
dialog { border: 0; border-radius: var(--r); padding: 22px; max-width: 92vw; width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.3); direction: rtl; font: inherit; color: var(--ink); }
dialog::backdrop { background: #0b3d9166; }
@media print { body { background: #fff; } .no-print, .sun, .waves, .petals { display: none !important; } #app { padding: 0; } }
