/* No webfonts: CSP allows font-src 'self' only, and we host none yet.
   The Hebrew system stack is genuinely good on every target device. */

:root {
  --bg: #f6f2fb;
  --surface: #ffffff;
  --ink: #1d1730;
  --muted: #6b5f80;
  --line: #e6ddf1;
  --accent: #6b34d4;
  --accent-soft: #efe6ff;
  --coral: #ff6f5e;
  --ok: #16875c;
  --ok-soft: #e3f6ee;
  --radius: 20px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 1.5rem 1.25rem 4rem;
  background: var(--bg);
  color: var(--ink);
  font-family: "Assistant", "Segoe UI", "Arial Hebrew", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
}

.screen { max-width: 40rem; margin: 0 auto; }
.boot { max-width: 40rem; margin: 4rem auto; color: var(--muted); }

/* ------------------------------------------------------------------ gate */

.hero { padding: 18vh 0 0; text-align: center; }

.wordmark {
  margin: 0;
  direction: ltr;
  font-size: clamp(3rem, 14vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  background: linear-gradient(100deg, var(--accent), var(--coral));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  margin: 0.25rem 0 2.5rem;
  color: var(--muted);
  font-size: 1.125rem;
}

/* --------------------------------------------------------------- controls */

.btn {
  display: inline-block;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.6rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.5; cursor: default; }

.btn-ghost { background: transparent; color: var(--muted); padding: 0.5rem 0.9rem; }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent); }

.btn-link {
  background: none;
  padding: 0.4rem 0;
  color: var(--accent);
  text-decoration: underline;
  font-weight: 500;
}

.input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: inherit;
  font: inherit;
}

.input:focus { outline: none; border-color: var(--accent); }
.input:disabled { background: #f3f0f8; color: var(--muted); }

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card h2 { margin: 0 0 0.5rem; font-size: 1.4rem; }
.card-narrow { margin-top: 15vh; }
.muted { color: var(--muted); margin-top: 0; }
.intro { margin: 0; color: var(--muted); }

.error { color: var(--coral); font-size: 0.9rem; margin: 0.5rem 0 0; }

.card-narrow .input { margin: 1rem 0 0.75rem; }

/* ----------------------------------------------------------------- topbar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.identity { display: flex; align-items: center; gap: 0.75rem; }

.avatar {
  /* Slot for the character art once it exists. Initial until then. */
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--accent), var(--coral));
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
}

.identity-name { font-weight: 700; }
.identity-score { color: var(--muted); font-size: 0.9rem; }
.counter { color: var(--muted); font-size: 0.9rem; }

/* --------------------------------------------------------------- progress */

.progress-shell {
  height: 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  overflow: hidden;
  margin-bottom: 2rem;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--coral));
  transition: width 0.5s cubic-bezier(0.2, 0.9, 0.3, 1);
}

/* ---------------------------------------------------------------- lessons */

.section-title { font-size: 1rem; color: var(--muted); margin: 0 0 0.75rem; font-weight: 600; }

.lesson-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }

.lesson-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  color: inherit;
  text-align: start;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.lesson-button:hover { border-color: var(--accent); transform: translateX(-3px); }
.lesson-button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.lesson-num {
  flex: 0 0 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.lesson-body { display: flex; flex-direction: column; }
.lesson-title { font-weight: 600; }
.lesson-meta { color: var(--muted); font-size: 0.875rem; }

.lesson-item.complete .lesson-num { background: var(--ok-soft); color: var(--ok); }
.lesson-item.complete .lesson-meta { color: var(--ok); }

/* -------------------------------------------------------------- challenge */

.challenge .prompt { margin: 0 0 1.25rem; font-size: 1.15rem; font-weight: 600; }

.answer-row { display: flex; gap: 0.6rem; align-items: stretch; }
.answer-row .btn { white-space: nowrap; }

.hint {
  margin: 0.25rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.95rem;
}

.feedback {
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  font-weight: 600;
}

.feedback.ok { background: var(--ok-soft); color: var(--ok); }
.feedback.bad { background: #ffecea; color: #c0392b; }

.challenge .btn-primary[id="challenge-next"] { margin-top: 1rem; }

@media (max-width: 480px) {
  .answer-row { flex-direction: column; }
}

/* ------------------------------------------------------- lesson content */

.lesson-heading { font-size: 1.6rem; margin: 0 0 1.25rem; }
.btn-wide { width: 100%; margin-top: 0.5rem; }

.block { margin: 0 0 1rem; }
.block-text { font-size: 1.05rem; }

.block-term {
  background: var(--surface);
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--accent);
  border-radius: 14px;
  padding: 1rem 1.25rem;
}

.term-name {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.term-text { margin: 0; }

.block-tip {
  background: #fff4f1;
  border-radius: 14px;
  padding: 0.9rem 1.15rem;
  color: #a8402f;
  font-weight: 500;
}

/* --------------------------------------------------------------- options */

.options { display: grid; gap: 0.6rem; }

.option {
  width: 100%;
  padding: 0.85rem 1.15rem;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.option:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.option:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.option:disabled { cursor: default; opacity: 0.75; }

.option-right {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 600;
  opacity: 1;
}

.option-wrong { border-color: #e79c94; background: #ffecea; color: #c0392b; }

.block-media {
  margin: 0 0 1.25rem;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.block-media img {
  display: block;
  width: 100%;
  height: auto;
}

.media-caption {
  padding: 0.65rem 1rem 0.9rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.media-notes {
  margin: 0;
  padding: 0.9rem 1.25rem 1.1rem;
  list-style: none;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
}

.media-notes li { padding: 0.15rem 0; }
