:root {
  --bg: #EEF3FB;
  --work-bg: #F7FAFF;
  --card: #FFFFFF;
  --text: #0F1B33;
  --muted: #5B6B8C;
  --border: #D8E2F2;
  --border-soft: #E4EBF8;
  --accent: #0038B8;
  --accent-dark: #002A8A;
  --gold: #E0A83C;
  --gold-dark: #8A6410;
  --gold-bg: #FDF4E3;
  --good: #0E8C6A;
  --good-dark: #0B6A51;
  --good-bg: #EAF7F2;
  --bad: #C62B3F;
  --bad-dark: #A32233;
  --bad-bg: #FCEDEE;
  --warn: #B8860B;
  --header-1: #0038B8;
  --header-2: #1E3A8A;
  --header-3: #16295E;
  --on-blue-muted: #C6D6F5;
  --radius: 18px;
  --niqqud: #D6001C;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Noto Sans Hebrew", "Noto Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--gold-dark); }

/* ---- Page background art (PNG illustrations) ----
   Fixed layer behind everything; the illustrations stay visible in the page
   margins on desktop and in the corners on mobile. Replaces the old
   repeating SVG icon wallpaper. */
.bg-art {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-art img {
  position: absolute;
  opacity: .8;
}

.bg-art-1 { top: 4vh;    left: -5vw;  width: clamp(150px, 26vw, 460px); }
.bg-art-2 { top: 2vh;    right: -4vw; width: clamp(140px, 23vw, 420px); }
.bg-art-3 { bottom: 2vh; left: -4vw;  width: clamp(135px, 22vw, 390px); }
.bg-art-4 { bottom: 4vh; right: -5vw; width: clamp(150px, 25vw, 440px); }

header, nav, main { position: relative; z-index: 1; }

header {
  position: relative;
  background: linear-gradient(135deg, var(--header-1) 0%, var(--header-2) 62%, var(--header-3) 100%);
  color: white;
  padding: 26px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  overflow: hidden;
  flex-wrap: wrap;
}

/* Header logo: Lottie marks in their own colors, so they need a white plate. */
.logo-medallion {
  position: relative;
  width: 68px;
  height: 68px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #FFFFFF;
  border: 1px solid rgba(255,255,255,.6);
  box-shadow: 0 2px 10px rgba(0,20,70,.25);
}

#logo-lottie {
  width: 50px;
  height: 50px;
  opacity: 0;
  transition: opacity .55s ease;
}

.header-title-block {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.header-title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.header-title-he {
  font-family: "Noto Sans Hebrew", sans-serif;
  font-weight: 600;
  font-size: 27px;
}

.header-title-ru {
  font-family: Rubik, sans-serif;
  font-weight: 600;
  font-size: 27px;
  letter-spacing: -.01em;
}

.header-title-block p {
  margin: 0;
  font-size: 14px;
  color: var(--on-blue-muted);
}

nav {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 18px 16px;
  flex-wrap: wrap;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

nav button {
  font-family: Rubik, sans-serif;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: white;
  color: var(--accent);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}

nav button:hover { border-color: var(--accent); }

nav button.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Transparent so the background illustrations read behind the cards,
   including on phones where main fills the whole width. */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px 60px;
  background: transparent;
}

.tab { display: none; }
.tab.active { display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 6px 20px -12px rgba(0,42,138,.28), 0 1px 2px rgba(15,27,51,.04);
}

textarea, input[type="text"] {
  width: 100%;
  font-size: 24px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--work-bg);
  direction: rtl;
  font-family: "Noto Sans Hebrew", "Arial Hebrew", sans-serif;
}

textarea:focus, input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

button.primary {
  font-family: Rubik, sans-serif;
  background: var(--accent);
  color: white;
  border: none;
  padding: 13px 26px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 12px;
}

button.primary:hover { background: var(--accent-dark); }
button.primary:disabled { opacity: 0.5; cursor: default; }

button.secondary {
  font-family: Rubik, sans-serif;
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--border);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
}

button.secondary:hover { border-color: var(--accent); }
button.secondary:disabled { opacity: 0.6; cursor: default; }

.grammar-checked-label {
  color: var(--good-dark);
  font-family: Rubik, sans-serif;
  font-weight: 600;
  font-size: 18px;
  text-align: center;
}

.grammar-check-card { text-align: center; }

.grammar-check-btn {
  width: 100%;
  font-size: 19px;
  padding: 18px 24px;
  margin-top: 0;
}

button.danger {
  font-family: Rubik, sans-serif;
  background: transparent;
  color: var(--bad);
  border: 1px solid var(--bad);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

.russian-translation {
  font-size: 26px;
  font-weight: 800;
  color: var(--good-dark);
  margin: 10px 0 20px;
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.word-card {
  border: 1.5px solid var(--border-soft);
  border-radius: 16px;
  padding: 16px;
  background: var(--card);
  transition: border-color .16s, transform .16s;
}

.word-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.word-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

/* Full-colour Judaica symbol SVG per detected word (assets/symbols/*.svg) —
   shown as a real illustration, not a faded watermark. */
.word-card-icon {
  width: 28px;
  height: 28px;
  flex: none;
}

.word-hebrew {
  font-family: "Noto Sans Hebrew", sans-serif;
  font-size: 34px;
  line-height: 1.4;
  direction: rtl;
  font-weight: 600;
}

.word-translation {
  color: #1C2B4A;
  font-size: 16px;
  margin-top: 4px;
}

.word-other-meanings {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  margin-top: 2px;
}

/* Niqqud (vowel points, dagesh, sheva) gets its own color everywhere Hebrew
   text is rendered, so the child can visually pick the vowel marks out from
   the consonants - reading is taught this way (+ the niqqud legend) instead
   of via a Russian phonetic transcription, which was frequently wrong. */
.niqqud {
  color: var(--niqqud);
}

.niqqud-legend {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-soft);
}

.niqqud-legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px 14px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  align-items: center;
}

.niqqud-legend-mark {
  font-family: "Noto Sans Hebrew", sans-serif;
  font-size: 36px;
  font-weight: 600;
  direction: rtl;
  color: var(--text);
  margin-right: 4px;
}

.pos-badge {
  font-family: Rubik, sans-serif;
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 999px;
  margin-top: 8px;
}

.pos-noun { background: var(--gold-bg); color: var(--gold-dark); }
.pos-verb { background: var(--good-bg); color: var(--good-dark); }
.pos-adjective { background: #E9EFFC; color: var(--accent); }
.pos-adverb { background: #EEF3FB; color: var(--muted); }
.pos-pronoun { background: #E9EFFC; color: var(--accent); }
.pos-preposition { background: #EEF3FB; color: var(--muted); }
.pos-conjunction { background: #EEF3FB; color: var(--muted); }
.pos-numeral { background: var(--gold-bg); color: var(--gold-dark); }
.pos-particle { background: #EEF3FB; color: var(--muted); }
.pos-interjection { background: var(--gold-bg); color: var(--gold-dark); }
.pos-article { background: #EEF3FB; color: var(--muted); }

.word-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.verb-details {
  margin-top: 10px;
  border-top: 1px dashed var(--border-soft);
  padding-top: 8px;
  font-size: 12px;
}

.verb-infinitive {
  direction: rtl;
  font-family: "Noto Sans Hebrew", sans-serif;
  font-size: 28px;
  line-height: 1.7;
  font-weight: 600;
  color: var(--accent-dark);
  margin-bottom: 6px;
}

.conj-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 4px;
  font-size: 13px;
}

.conj-table td {
  border: 1px solid var(--border-soft);
  padding: 4px 6px;
}

.conj-table td:first-child {
  color: var(--muted);
  white-space: nowrap;
}

.conj-table td:last-child {
  direction: rtl;
  font-family: "Noto Sans Hebrew", sans-serif;
  font-weight: 600;
  font-size: 17px;
  line-height: 1.7;
}

.conj-section-title {
  font-family: Rubik, sans-serif;
  font-weight: 600;
  margin-top: 8px;
  color: var(--accent-dark);
}

.info-box {
  margin-top: 10px;
  border-top: 1px dashed var(--border-soft);
  padding-top: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.info-box-title {
  font-family: Rubik, sans-serif;
  font-weight: 600;
  color: var(--accent-dark);
  margin-bottom: 4px;
}

.prep-list {
  margin: 4px 0;
  padding-left: 18px;
}

.prep-list li {
  margin-bottom: 3px;
}

.prep-exception {
  margin-top: 6px;
  font-weight: 700;
  color: var(--warn);
}

.tutor-note {
  background: var(--gold-bg);
  border-color: #F0DFB8;
}

.tutor-note-title {
  font-family: Rubik, sans-serif;
  font-weight: 600;
  color: var(--gold-dark);
  margin-bottom: 8px;
  font-size: 16px;
}

.mistake-box {
  background: #FFF7ED;
  border-color: #FED7AA;
}

.mistake-title {
  font-family: Rubik, sans-serif;
  font-weight: 600;
  color: var(--warn);
  margin-bottom: 8px;
  font-size: 16px;
}

.mistake-item {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #FED7AA;
  font-size: 20px;
  line-height: 1.7;
}

.mistake-arrow {
  margin: 0 6px;
  color: var(--muted);
  font-size: 15px;
}

.mistake-explanation {
  font-size: 14px;
  color: var(--text);
  margin-top: 4px;
  direction: ltr;
}

/* A quick "did you know" nugget shown while a slower analysis/table-build
   call is still running - deliberately large and bold so it actually draws
   the child's attention during the wait, instead of blending into the small
   loading-status text next to it. */
.loading-tip {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--gold-bg);
  border: 1px solid #F0DFB8;
  border-radius: var(--radius);
  text-align: start;
  direction: ltr;
}

.loading-tip-icon {
  font-size: 20px;
  margin-bottom: 4px;
}

.loading-tip-text {
  font-family: Rubik, sans-serif;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
}

/* Example sentence shown after answering a vocab/verb-conjugation quiz
   question, same purpose as the Spanish app's per-word example box. */
.example-box {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--work-bg);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
}

.example-hebrew {
  font-family: "Noto Sans Hebrew", sans-serif;
  font-size: 20px;
  direction: rtl;
  margin-bottom: 4px;
}

.example-ru {
  font-size: 14px;
  color: var(--muted);
}

.history-item {
  cursor: pointer;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.history-hebrew {
  font-family: "Noto Sans Hebrew", sans-serif;
  font-size: 30px;
  line-height: 1.7;
  direction: rtl;
  font-weight: 600;
}

.history-date {
  font-size: 12px;
  color: var(--muted);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 3px solid rgba(0,56,184,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-left: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-indicator {
  margin-top: 14px;
  text-align: center;
}

.loading-bar-track {
  width: 100%;
  height: 10px;
  background: var(--border-soft);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  border-radius: 999px;
  animation-name: loadingFill;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes loadingFill { from { width: 0%; } to { width: 92%; } }

.loading-message {
  font-family: Rubik, sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-dark);
  margin-bottom: 4px;
}

.loading-estimate {
  font-size: 12px;
  color: var(--muted);
}

.error-box {
  background: var(--bad-bg);
  border: 1px solid #F3C6CC;
  color: var(--bad-dark);
  padding: 12px;
  border-radius: 10px;
  margin-top: 12px;
}

.test-progress {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}

.test-question {
  font-size: 24px;
  margin: 12px 0 20px;
}

.word-diff {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  direction: rtl;
  font-family: "Noto Sans Hebrew", sans-serif;
  font-size: 22px;
  line-height: 1.6;
  margin: 14px 0;
}

.diff-word {
  padding: 6px 10px;
  border-radius: 8px;
}

.diff-correct { background: var(--good-bg); color: var(--good-dark); }
.diff-wrong { background: var(--bad-bg); color: var(--bad-dark); text-decoration: line-through; }
.diff-missing { background: var(--gold-bg); color: var(--gold-dark); border: 1px dashed var(--gold-dark); }
.diff-extra { background: #EEF3FB; color: var(--muted); text-decoration: line-through; }

.feedback-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: 10px;
  font-size: 16px;
}

.feedback-correct { background: var(--good-bg); color: var(--good-dark); }
.feedback-incorrect { background: var(--bad-bg); color: var(--bad-dark); }

.correct-answer {
  margin-top: 10px;
  font-family: "Noto Sans Hebrew", sans-serif;
  font-size: 24px;
  line-height: 1.7;
  direction: rtl;
  font-weight: 600;
}

.score-summary {
  text-align: center;
  font-size: 22px;
  padding: 30px 0;
}

#login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 27, 51, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.login-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 30px rgba(15, 27, 51, 0.3);
}

.login-box h2 {
  margin: 0 0 8px;
  font-family: Rubik, sans-serif;
}

.login-box p {
  color: var(--muted);
  margin: 0 0 16px;
}

.login-box input {
  direction: ltr;
  text-align: center;
  font-size: 18px;
  margin-bottom: 12px;
}

.login-box button {
  width: 100%;
}

#login-error {
  color: var(--bad);
  margin-top: 10px;
  font-size: 14px;
  min-height: 18px;
}

/* ---- Test menu: 3 cards + per-test page ---- */
.test-select {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.test-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 14px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  transition: transform 0.1s ease, border-color 0.15s;
}
.test-card:hover { border-color: var(--accent); }
.test-card:active { transform: scale(0.97); }
.test-card-icon { font-size: 30px; margin-bottom: 8px; }
.test-card-title { font-family: Rubik, sans-serif; font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.test-card-desc { font-size: 12.5px; color: var(--muted); line-height: 1.4; }

.test-category-header {
  font-family: Rubik, sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--accent);
  text-align: center;
  margin-bottom: 12px;
}
.test-back-btn {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 16px;
  background: var(--header-2);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  font-family: Rubik, sans-serif;
  cursor: pointer;
}
.test-back-btn:active { opacity: 0.85; }

.test-hebrew-word {
  font-size: 34px;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
  margin: 8px 0 4px;
}
.test-subtle {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 12px;
}
.test-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.test-option {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--work-bg);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.test-option:hover:not(:disabled) { border-color: var(--accent); background: #fff; }
.test-option:disabled { cursor: default; }
.test-option.option-correct { background: var(--good-bg); border-color: var(--good); color: var(--good-dark); }
.test-option.option-wrong { background: var(--bad-bg); border-color: var(--bad); color: var(--bad-dark); }

/* Verb conjugation drill rows */
.conj-row { padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.conj-row:last-of-type { border-bottom: none; }
.conj-row-main { display: flex; align-items: center; gap: 8px; }
.conj-person {
  width: 118px;
  flex: none;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.conj-person small { font-weight: 400; color: var(--muted); font-size: 11px; }
.conj-input {
  flex: 1;
  min-width: 0;
  padding: 9px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
}
.conj-input:focus { border-color: var(--accent); }
.conj-input:disabled { background: var(--work-bg); color: var(--muted); }
.check-sm {
  flex: none;
  padding: 9px 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: Rubik, sans-serif;
  cursor: pointer;
}
.check-sm:disabled { opacity: 0.5; cursor: default; }
.conj-comment { font-size: 13px; line-height: 1.45; }
.conj-comment:not(:empty) { margin-top: 6px; }
.cell-ok { color: var(--good-dark); font-weight: 700; }
.cell-bad { color: var(--bad-dark); font-weight: 700; }
.cell-explain { color: var(--muted); font-weight: 400; margin-top: 3px; }

/* ---- Mobile ---- */
@media (max-width: 700px) {
  header { padding: 20px 16px; gap: 14px; }
  .logo-medallion { width: 58px; height: 58px; }
  #logo-lottie { width: 42px; height: 42px; }
  .header-title-he, .header-title-ru { font-size: 22px; }
  nav { padding: 14px 12px; gap: 8px; }
  nav button { padding: 9px 16px; font-size: 14px; }
  main { padding: 16px 12px 48px; }
  .card { padding: 16px; border-radius: 16px; }
  .bg-art img { opacity: .55; }
  .bg-art-1 { top: 2vh;    left: -14vw;  width: 46vw; }
  .bg-art-2 { top: 26vh;   right: -16vw; width: 44vw; }
  .bg-art-3 { bottom: 22vh; left: -16vw; width: 44vw; }
  .bg-art-4 { bottom: 1vh;  right: -14vw; width: 46vw; }
  .test-select { grid-template-columns: 1fr; }
  .conj-row-main { flex-wrap: wrap; }
  .conj-person { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; transition-duration: .001s !important; }
}

/* Past/future tables on a tap; the row of choices under a verb card or a test verb. */
.conj-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.conj-buttons button { margin-top: 0; }
button.conj-btn { font-size: 13px; padding: 7px 14px; }
