/* מאמן אנגלית — English Trainer styles */

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(120% 90% at 50% 0%, #EAF7FB 0%, #D6EAF2 60%, #C6E0EA 100%);
  font-family: Rubik, system-ui, sans-serif;
  color: #12313F;
  direction: rtl;
}

#exam-root {
  max-width: 680px;
  margin: 0 auto;
  padding: 14px;
}

/* ── Top bar ── */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.brand { font-family: 'Fredoka', sans-serif; font-size: 15px; color: #0B2430; }
.brand span { color: #FFB627; margin: 0 2px; }
.who { font-size: 12px; opacity: .65; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pausebtn {
  background: #fff;
  border: none;
  border-radius: 11px;
  width: 34px;
  height: 34px;
  font-size: 15px;
  cursor: pointer;
  color: #0B2430;
  flex-shrink: 0;
}
.score {
  background: #0B2430;
  color: #fff;
  border-radius: 14px;
  padding: 6px 12px;
  font-family: 'Secular One', sans-serif;
  font-size: 19px;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 3px;
  flex-shrink: 0;
}
.score small { font-family: Rubik, sans-serif; font-size: 10px; opacity: .7; }

/* ── Card ── */
.card {
  background: #F2FAFC;
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 12px 30px -18px rgba(11,36,48,.55);
  border: 1px solid #fff;
}
.hero h1 {
  font-family: 'Secular One', sans-serif;
  font-size: 30px;
  line-height: 1.15;
  margin: 6px 0 8px;
}
.hero h1 .of { font-size: 16px; opacity: .5; }
.sub { font-size: 14px; opacity: .72; margin: 0 0 16px; line-height: 1.6; }
.eyebrow {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #6C5CE7;
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}
.lead { font-family: 'Secular One', sans-serif; font-size: 19px; margin: 4px 0 0; }
.foot { font-size: 12px; opacity: .55; margin: 0 0 14px; }

/* ── Part bar ── */
.part-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}
.bar-side { display: flex; align-items: center; gap: 8px; }
.counter {
  font-size: 12px;
  background: #fff;
  border-radius: 9px;
  padding: 3px 8px;
  opacity: .75;
  white-space: nowrap;
}

/* ── Hourglass ── */
.hg { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.hg-frame { fill: #0B2430; }
.hg-glass { fill: #fff; stroke: #0B2430; stroke-width: 1.4; }
.hg-sand { fill: #FFB627; }
.hg-time { font-size: 11px; font-variant-numeric: tabular-nums; opacity: .7; }
.hg-low { color: #F2545B; opacity: 1; font-weight: 700; }

/* ── Picture ── */
.pic {
  font-size: 96px;
  text-align: center;
  line-height: 1.1;
  margin: 6px 0 16px;
  filter: drop-shadow(0 8px 14px rgba(11,36,48,.18));
}

/* ── Options ── */
.opts { display: grid; gap: 9px; }
.opt {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border: 2px solid #DCE9EE;
  border-radius: 15px;
  padding: 13px 15px;
  font-family: 'Fredoka', sans-serif;
  font-size: 17px;
  color: #0B2430;
  cursor: pointer;
  text-align: start;
  transition: border-color .15s, transform .15s;
  width: 100%;
}
.opt:hover:not([disabled]) { border-color: #6C5CE7; transform: translateY(-1px); }
.opt-good { border-color: #3FBF6F !important; background: #EDFBF1; }
.opt-bad  { border-color: #F2545B !important; background: #FDEDEE; }
.opt-dim  { opacity: .45; }
.mark { font-size: 19px; font-weight: 700; }
.mark.good { color: #3FBF6F; }
.mark.bad  { color: #F2545B; }
.hint { font-size: 13px; margin: 12px 0 0; }

/* ── Story / cloze ── */
.story {
  font-family: 'Fredoka', sans-serif;
  font-weight: 500;
  font-size: 15px;
  line-height: 2;
  background: #fff;
  border-radius: 15px;
  padding: 15px;
  margin: 0 0 14px;
}
.story.scroll { max-height: 44vh; overflow-y: auto; line-height: 1.75; }
.story p { margin: 0 0 12px; }
.cloze .blank { color: #6C5CE7; font-weight: 600; white-space: nowrap; }
.cloze .blank sup { font-size: 10px; opacity: .7; }
.cloze .blank.done { color: #3FBF6F; border-bottom: 2px solid #3FBF6F; }
.question {
  font-family: 'Fredoka', sans-serif;
  font-size: 17px;
  background: #fff;
  border-radius: 15px;
  padding: 14px;
  margin: 0 0 12px;
}

/* ── Word bank ── */
.bank { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.chip {
  background: #fff;
  border: 2px solid #DCE9EE;
  border-radius: 11px;
  padding: 7px 11px;
  font-family: 'Fredoka', sans-serif;
  font-size: 14px;
  color: #0B2430;
  cursor: pointer;
}
.chip:hover:not([disabled]) { border-color: #6C5CE7; }
.chip-sel { border-color: #6C5CE7 !important; background: #EFEDFD; }
.chip-used { opacity: .3; text-decoration: line-through; cursor: default; }

/* ── Placer ── */
.placer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: #fff;
  border-radius: 15px;
  padding: 11px;
  margin-bottom: 10px;
}
.placer.center { justify-content: center; }
.placer input {
  border: 2px solid #DCE9EE;
  border-radius: 11px;
  padding: 9px 11px;
  font-size: 16px;
  width: 80px;
  font-family: 'Fredoka', sans-serif;
}
.placer.center input { width: min(260px, 60vw); }
.placer input:focus { outline: none; border-color: #6C5CE7; }

/* ── Form fields ── */
.fld { display: block; font-size: 13px; margin-bottom: 14px; opacity: .85; }
.fld input[type=text],
.fld input[type=tel],
.fld input:not([type]) {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 2px solid #DCE9EE;
  border-radius: 13px;
  padding: 12px;
  font-size: 16px;
  font-family: Rubik, sans-serif;
}
.fld input[type=range] { width: 100%; margin-top: 8px; accent-color: #6C5CE7; }
.fld b { font-family: 'Secular One', sans-serif; font-size: 15px; }

/* ── Buttons ── */
.primary {
  width: 100%;
  background: #6C5CE7;
  color: #fff;
  border: none;
  border-radius: 15px;
  padding: 14px;
  font-family: 'Secular One', sans-serif;
  font-size: 17px;
  cursor: pointer;
  box-shadow: 0 8px 18px -10px #6C5CE7;
  margin-top: 4px;
}
.primary:disabled { opacity: .4; box-shadow: none; cursor: not-allowed; }
.primary.sm, .ghost.sm { width: auto; padding: 9px 14px; font-size: 14px; margin-top: 0; }
.ghost {
  width: 100%;
  background: none;
  border: none;
  color: #0B2430;
  opacity: .6;
  padding: 12px;
  font-family: Rubik, sans-serif;
  font-size: 14px;
  cursor: pointer;
  margin-top: 10px;
}

/* ── Plan list ── */
.plan { list-style: none; padding: 0; margin: 12px 0 10px; display: grid; gap: 8px; counter-reset: s; }
.plan li {
  counter-increment: s;
  background: #fff;
  border-radius: 15px;
  padding: 13px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .15s;
}
.plan li:hover { border-color: #6C5CE7; }
.plan li::before { content: counter(s); font-family: 'Secular One', sans-serif; color: #FFB627; margin-inline-end: 10px; }
.plan li b { font-family: 'Secular One', sans-serif; font-size: 16px; flex: 1; }
.plan li span { font-size: 12px; opacity: .6; }

/* ── History list ── */
.hist { list-style: none; padding: 0; margin: 8px 0 16px; display: grid; gap: 5px; }
.hist li { display: flex; justify-content: space-between; background: #fff; border-radius: 11px; padding: 8px 12px; font-size: 13px; }
.hist li b { font-family: 'Secular One', sans-serif; color: #6C5CE7; }

/* ── Toast ── */
.toast {
  position: fixed;
  inset-inline: 0;
  bottom: 22px;
  margin: auto;
  width: max-content;
  max-width: 88vw;
  display: flex;
  align-items: center;
  gap: 9px;
  background: #0B2430;
  color: #fff;
  border-radius: 16px;
  padding: 12px 18px;
  font-family: 'Secular One', sans-serif;
  font-size: 16px;
  box-shadow: 0 16px 30px -14px rgba(0,0,0,.5);
  animation: pop .18s ease-out;
  z-index: 999;
}
.toast-mark { font-size: 20px; }
.toast-good .toast-mark { color: #7CF0A5; }
.toast-bad  .toast-mark { color: #FF9AA0; }
@keyframes pop { from { transform: translateY(14px) scale(.94); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .opt { transition: none; }
}
@media (min-width: 640px) {
  #exam-root { padding: 22px; }
  .hero h1 { font-size: 38px; }
}

/* ══════════ Part 5 · Word ↔ Meaning matching ══════════ */
.match {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 4px;
  background: linear-gradient(135deg,#FFF6E9 0%,#EAF6FF 50%,#F3EEFF 100%);
  border-radius: 18px;
  touch-action: none;
}
.match-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 1;
}
.match-line { stroke: #3FBF6F; stroke-width: 4; stroke-linecap: round; }
.match-line.solved { stroke: #3FBF6F; filter: drop-shadow(0 1px 2px rgba(63,191,111,.5)); }
.match-line.wrong  { stroke: #F2545B; stroke-dasharray: 6 5; }
.match-temp { stroke: #6C5CE7; stroke-width: 4; stroke-linecap: round; stroke-dasharray: 2 7; opacity: .85; }
.mcol {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  position: relative;
  z-index: 2;
}
.mitem, .ritem {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 2px solid #DCE9EE;
  border-radius: 14px;
  padding: 12px 12px;
  font-family: 'Fredoka', sans-serif;
  font-size: 16px;
  color: #0B2430;
  cursor: pointer;
  box-shadow: 0 4px 10px -8px rgba(11,36,48,.5);
  transition: transform .12s, border-color .12s, background .12s;
}
.mitem { justify-content: flex-start; }
.ritem { justify-content: flex-end; font-family: Rubik, sans-serif; font-weight: 500; }
.mitem span, .ritem span { flex: 1; }
.mitem:hover, .ritem:hover { border-color: #6C5CE7; transform: translateY(-1px); }
.mitem.solved, .ritem.solved {
  border-color: #3FBF6F;
  background: #EDFBF1;
  color: #1f9e56;
  cursor: default;
  box-shadow: none;
}
.mitem.shake, .ritem.shake, .balloon.shake, .wchip.shake { animation: shake .4s; border-color: #F2545B; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #6C5CE7; flex: 0 0 auto; box-shadow: 0 0 0 3px rgba(108,92,231,.18); }
.mitem.solved .dot, .ritem.solved .dot { background: #3FBF6F; box-shadow: 0 0 0 3px rgba(63,191,111,.2); }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ══════════ Part 6 · Balloons ══════════ */
.balloons {
  position: relative;
  background: linear-gradient(180deg,#EAF7FF 0%,#F6FBFF 70%);
  border-radius: 18px;
  padding: 10px 6px 14px;
  touch-action: none;
}
.bln-row {
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  gap: 6px;
  position: relative;
  z-index: 2;
  min-height: 130px;
}
.balloon {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  width: 62px;
}
.bln-body {
  width: 54px;
  height: 66px;
  border-radius: 50% 50% 48% 48% / 55% 55% 45% 45%;
  background: radial-gradient(circle at 34% 30%, #ffffffcc 0%, var(--bc) 45%, color-mix(in srgb, var(--bc) 78%, #000) 100%);
  box-shadow: inset -5px -6px 10px -6px rgba(0,0,0,.35), 0 8px 14px -8px rgba(11,36,48,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  animation: float 3.2s ease-in-out infinite;
}
.balloon:nth-child(odd) .bln-body { animation-delay: -1.4s; }
.bln-body::after {
  content: "";
  position: absolute;
  bottom: 58px;
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid var(--bc);
}
.bln-emoji { filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.bln-string { width: 2px; height: 34px; background: linear-gradient(#b9c6cc,#8aa0a8); margin-top: 2px; }
.balloon .dot-b { margin-top: -3px; }
.balloon.solved .bln-body { animation: none; opacity: .55; }
.balloon.solved { cursor: default; }
.bln-words {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  position: relative;
  z-index: 2;
}
.wchip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 2px solid #DCE9EE;
  border-radius: 13px;
  padding: 10px 13px;
  font-family: 'Fredoka', sans-serif;
  font-size: 16px;
  color: #0B2430;
  cursor: pointer;
  box-shadow: 0 4px 10px -8px rgba(11,36,48,.5);
}
.wchip:hover { border-color: #6C5CE7; }
.wchip.solved { border-color: #3FBF6F; background: #EDFBF1; color: #1f9e56; cursor: default; }
.wchip .dot-t { background: #FFB627; box-shadow: 0 0 0 3px rgba(255,182,39,.22); }
.wchip.solved .dot-t { background: #3FBF6F; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

/* richer picture prompt */
.pic {
  background: radial-gradient(circle at 50% 42%, #ffffff 0%, #EAF6FF 60%, transparent 72%);
  border-radius: 24px;
}

@media (prefers-reduced-motion: reduce) {
  .bln-body, .balloon:nth-child(odd) .bln-body { animation: none; }
  .mitem, .ritem { transition: none; }
}

/* ══════════ Subject picker ══════════ */
.subjects { display:grid; grid-template-columns:1fr 1fr 1fr; gap:12px; margin-top:8px; }
.subj-btn {
  display:flex; flex-direction:column; align-items:center; gap:8px;
  background:#fff; border:2px solid #DCE9EE; border-radius:18px;
  padding:20px 8px; cursor:pointer; transition:transform .12s, border-color .12s;
  box-shadow:0 8px 20px -14px rgba(11,36,48,.5);
}
.subj-btn:hover { border-color:#6C5CE7; transform:translateY(-2px); }
.subj-btn b { font-family:'Fredoka',sans-serif; font-size:16px; color:#0B2430; }
.subj-ic { font-size:44px; line-height:1; }
@media (max-width:380px){ .subjects{ grid-template-columns:1fr; } .subj-btn{ flex-direction:row; justify-content:center; gap:14px; } .subj-ic{ font-size:34px; } }

.menu-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:8px; }
.menu-head .ghost.sm { width:auto; margin:0; padding:6px 10px; opacity:.7; }

/* ══════════ Math ══════════ */
.math-q {
  font-family:'Secular One',sans-serif; font-size:40px; text-align:center;
  color:#0B2430; background:linear-gradient(135deg,#EAF6FF,#F3EEFF);
  border-radius:18px; padding:22px 10px; margin:4px 0 14px;
  letter-spacing:1px;
}
.opt-center { justify-content:center; font-size:22px; font-family:'Secular One',sans-serif; }
.opt-center .mark { position:absolute; inset-inline-end:14px; }
.opt-center { position:relative; }

/* ── subject picker on login (selected state) ── */
.subj-on { border-color: #6C5CE7 !important; background: #EFEDFD !important; box-shadow: 0 6px 16px -10px #6C5CE7; }

/* ── Hebrew MC prompt (definition / word) ── */
.mc-prompt {
  font-family: 'Fredoka', sans-serif;
  font-size: 22px; font-weight: 600;
  background: linear-gradient(135deg,#F3EEFF,#EAF6FF);
  border-radius: 16px; padding: 20px 16px; margin: 4px 0 14px;
  text-align: center; color: #0B2430; line-height: 1.5;
}
/* ── Math word-problem text ── */
.math-word {
  display: block; font-family: 'Fredoka', sans-serif; font-weight: 500;
  font-size: 17px; line-height: 1.7; text-align: right;
}

/* ── cloze blank buttons + hint ── */
.blankbtn { background: none; border: none; color: #6C5CE7; font-weight: 600; font-family: inherit; font-size: inherit; cursor: pointer; padding: 0 2px; white-space: nowrap; }
.blankbtn sup { font-size: 10px; opacity: .7; }
.blankbtn-on { background: #EFEDFD; border-radius: 6px; }
.qbtn { width: 17px; height: 17px; line-height: 1; border-radius: 50%; border: none; background: #FFB627; color: #0B2430; font-size: 11px; font-weight: 700; cursor: pointer; padding: 0; margin-inline-start: 2px; vertical-align: middle; }

/* ── bottom sheet (word bank / hint) ── */
.sheet {
  position: fixed; inset-inline: 0; bottom: 0; background: #fff;
  border-radius: 22px 22px 0 0; padding: 16px 16px 24px;
  box-shadow: 0 -14px 34px -18px rgba(11,36,48,.7);
  max-height: 62vh; overflow: auto; z-index: 40; animation: up .2s ease-out;
}
@media (min-width: 640px){ .sheet { max-width: 680px; margin: 0 auto; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-family: 'Secular One', sans-serif; font-size: 16px; }
.sheet-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.hinttext { font-family: 'Fredoka', sans-serif; font-size: 17px; line-height: 1.6; background: #F2FAFC; border-radius: 14px; padding: 14px; margin: 0 0 8px; }
@keyframes up { from { transform: translateY(26px); opacity: 0; } }

/* ═══════════ Gamification (Phase 1) ═══════════ */
.done-card { position: relative; overflow: hidden; text-align: center; }
.done-card .eyebrow, .done-card h1, .done-card .sub { text-align: center; }
.stars { font-size: 40px; letter-spacing: 6px; margin: 4px 0 2px; }
.stars .star { color: #DCE9EE; }
.stars .star.on { color: #FFB627; text-shadow: 0 2px 6px rgba(255,182,39,.5); animation: pop .35s ease-out both; }
.stars .star.on:nth-child(2){ animation-delay:.12s } .stars .star.on:nth-child(3){ animation-delay:.24s }

.gain-row { display: flex; gap: 8px; justify-content: center; margin: 12px 0; }
.gain { background: #fff; border-radius: 14px; padding: 10px 14px; min-width: 80px; box-shadow: 0 6px 16px -12px rgba(11,36,48,.5); }
.gain b { display: block; font-family: 'Secular One', sans-serif; font-size: 20px; color: #6C5CE7; }
.gain small { font-size: 11px; opacity: .7; }

.levelup { background: linear-gradient(90deg,#6C5CE7,#8E7BFF); color: #fff; border-radius: 12px; padding: 10px; font-family: 'Secular One', sans-serif; margin: 8px 0; animation: pop .4s ease-out both; }
.new-badges { margin: 12px 0; }
.badge-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 6px; }
.badge { background: #FFF6E9; border: 2px solid #FFE3B0; border-radius: 14px; padding: 10px 12px; min-width: 78px; animation: pop .4s ease-out both; }
.badge-ic { font-size: 26px; display: block; }
.badge small { font-size: 11px; color: #0B2430; }
.badge-row.mini { justify-content: flex-start; gap: 6px; margin: 8px 0 0; }
.badge-chip { font-size: 20px; }

/* stats bar on the menu */
.statbar { display: flex; gap: 8px; margin: 4px 0 10px; }
.statbar .stat { flex: 1; background: #fff; border-radius: 12px; padding: 8px; text-align: center; font-size: 13px; box-shadow: 0 4px 12px -10px rgba(11,36,48,.5); }
.statbar .stat b { font-family: 'Secular One', sans-serif; font-size: 18px; color: #6C5CE7; }

/* confetti */
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -14px; width: 9px; height: 14px; border-radius: 2px; opacity: .9; animation-name: fall; animation-timing-function: linear; animation-iteration-count: 1; }
@keyframes fall { to { transform: translateY(120vh) rotate(720deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce){ .confetti i { display: none; } .stars .star.on,.badge,.levelup { animation: none; } }

/* ── Avatar picker + display (Phase 2) ── */
.avatars { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.av-btn { width: 46px; height: 46px; font-size: 24px; line-height: 1; background: #fff; border: 2px solid #DCE9EE; border-radius: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform .1s, border-color .1s; }
.av-btn:hover { border-color: #6C5CE7; }
.av-on { border-color: #6C5CE7 !important; background: #EFEDFD; transform: scale(1.08); box-shadow: 0 6px 14px -8px #6C5CE7; }
.hdr-av { font-size: 18px; } .menu-av { font-size: 18px; }
