/* Hebroni — Hebrew Quiz (/interactives/quiz/)
   Self-contained: uses /en/en.css variables only (light + dark via [data-theme]). */

:root { --muted-light: var(--muted); }

.hebrew {
  font-family: 'Frank Ruhl Libre', serif;
  direction: rtl;
  font-size: min(12vw, 64px);
}
.hebrew-md {
  font-family: 'Frank Ruhl Libre', serif;
  direction: rtl;
  font-size: clamp(1.6rem, 5vw, 2.2rem);
}
.hebrew-sm {
  font-family: 'Frank Ruhl Libre', serif;
  direction: rtl;
  font-size: clamp(1.4rem, 5vw, 2.2rem);
}

/* ── Shell ── */
.qz-shell { max-width: 480px; margin: 0 auto; }

/* ── Filter bar + order toggle ── */
.controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 20px;
}
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  flex: 1;
  min-width: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  user-select: none;
}
.filter-chip:hover { border-color: var(--gold); color: var(--gold); }
.filter-chip.active {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg);
  font-weight: 600;
}

.order-toggle {
  flex-shrink: 0;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  user-select: none;
  font-family: inherit;
}
.order-toggle:hover { border-color: var(--gold); color: var(--gold); }
.order-toggle.active {
  background: var(--gold-bg);
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 600;
}

/* ── Quiz picker popup ── */
.quiz-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,12,4,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
  padding: 20px;
  animation: quizModalFadeIn 0.2s ease;
}
.quiz-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px 24px;
  animation: quizModalPopIn 0.25s cubic-bezier(0.175,0.885,0.32,1.275);
}
.quiz-modal-header { text-align: center; margin-bottom: 20px; }
.quiz-modal-header h2 { font-size: 1.25rem; font-weight: 700; color: var(--text); margin: 0 0 6px; }
.quiz-modal-header p { font-size: 0.85rem; color: var(--muted); margin: 0; }
@keyframes quizModalFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes quizModalPopIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Quiz mode selection ── */
.quiz-mode-select {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 20px 18px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-top: 3px solid transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s, transform 0.15s, box-shadow 0.15s;
  position: relative;
}
.mode-card:hover:not(.active) {
  border-color: var(--gold);
  border-top-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.mode-card.active {
  border-color: var(--gold);
  border-top-color: var(--gold);
  background: var(--gold-bg);
  box-shadow: 0 4px 16px rgba(200,168,75,.12);
}
.mode-card-icon { font-size: 2rem; line-height: 1; }
.mode-card-text { display: flex; flex-direction: column; gap: 4px; }
.mode-card-title { font-weight: 700; font-size: 0.95rem; }
.mode-card-desc { font-size: 0.78rem; color: var(--muted); line-height: 1.45; }
.mode-card.active .mode-card-desc { color: var(--text-2); }
@media (max-width: 520px) {
  .quiz-mode-select { grid-template-columns: 1fr; }
  .mode-card { flex-direction: row; align-items: center; padding: 14px 16px; border-top: none; border-left: 3px solid transparent; }
  .mode-card:hover:not(.active) { border-left-color: var(--gold); transform: none; }
  .mode-card.active { border-left-color: var(--gold); }
  .mode-card-icon { font-size: 1.6rem; flex-shrink: 0; }
}

.quiz-begin-btn {
  display: block;
  width: 100%;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  padding: 14px 28px;
  text-align: center;
}

/* ── Score + progress ── */
.quiz-score-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 10px;
  font-size: 0.85rem;
  color: var(--muted);
}
.quiz-progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 20px;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-lt), var(--gold));
  transition: width 0.4s ease;
}

/* ── Question area ── */
#questionArea {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 0 28px;
  gap: 24px;
  min-height: 380px;
}
.quiz-question { text-align: center; }
.quiz-prompt { font-size: 0.9rem; color: var(--muted); margin-bottom: 12px; }
.quiz-symbol-display {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(48vw, min(38vh, 180px));
  height: min(48vw, min(38vh, 180px));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  color: var(--text);
}
.quiz-sound-hint { font-size: 0.88rem; color: var(--muted); margin-top: 4px; }

/* ── Options ── */
.quiz-options { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 400px; }
.quiz-option {
  width: 100%;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.quiz-option:hover:not(:disabled) { border-color: var(--gold); background: var(--gold-bg); }
.quiz-option:disabled { cursor: default; }
.quiz-option.answer-correct { background: rgba(45,158,95,0.15) !important; border-color: #2d9e5f !important; color: var(--text); }
.quiz-option.answer-wrong   { background: rgba(192,57,43,0.15) !important; border-color: #c0392b !important; }
.option-sound { font-size: 0.75rem; color: var(--muted); }

/* Symbol options (recognition mode) */
.quiz-symbols { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 10px; }
.quiz-symbol-opt {
  width: calc(50% - 5px);
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
}
.quiz-symbol-opt .hebrew-md { color: var(--text); background: var(--bg-alt); width: 72px; height: 72px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }

/* ── Matching ── */
.matching-grid { display: flex; gap: 16px; width: 100%; max-width: 400px; }
.matching-col { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.match-item {
  width: 100%;
  padding: 14px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}
.match-item:hover:not(:disabled):not(.matched) { border-color: var(--gold); }
.match-item.match-selected { border-color: var(--gold); background: var(--gold-bg); }
.match-item.matched { opacity: 0.45; cursor: default; }
.match-item.answer-correct { background: rgba(45,158,95,0.15) !important; border-color: #2d9e5f !important; }
.match-item.answer-wrong { background: rgba(192,57,43,0.15) !important; border-color: #c0392b !important; }

/* ── Complete screen ── */
#quizComplete {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 0;
  gap: 20px;
}
.qc-brand { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.qc-brand-title { font-size: 1.2rem; font-weight: 700; color: var(--text); }
.qc-brand-he { font-family: 'Frank Ruhl Libre', serif; font-size: 0.9rem; color: var(--muted); direction: rtl; }
.qc-mode { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gold); margin: 0; }
#quizComplete h2 { margin: 0; font-size: 1.4rem; }
.complete-stats { display: flex; gap: 28px; justify-content: center; }
.complete-stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.complete-stat-value { font-size: 2rem; font-weight: 700; color: var(--gold); }
.complete-stat-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.complete-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.complete-actions button.en-btn-primary,
.complete-actions button.en-btn-secondary {
  cursor: pointer;
  font-family: inherit;
}
.complete-actions button.en-btn-primary { border: none; }
.complete-actions button.en-btn-secondary { background: transparent; }

.wrong-review { width: 100%; max-width: 400px; text-align: left; }
.wrong-review-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-bottom: 8px; }
.wrong-item { display: flex; align-items: center; gap: 12px; padding: 10px; background: var(--bg-alt); border-radius: var(--radius-sm); margin-bottom: 6px; border: 1px solid rgba(192,57,43,0.2); }

/* ── Animations ── */
@keyframes popIn {
  0%   { transform: scale(0) rotate(-15deg); opacity: 0; }
  70%  { transform: scale(1.1) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}
.pop-in { animation: popIn 0.6s cubic-bezier(0.175,0.885,0.32,1.275) forwards; }

/* ── Badge toast ── */
.badge-toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card); border: 1px solid var(--gold);
  border-radius: var(--radius); padding: 12px 20px;
  display: flex; align-items: center; gap: 12px;
  font-size: 0.95rem; color: var(--text); box-shadow: var(--shadow-lg);
  opacity: 0; transition: opacity 0.35s ease, transform 0.35s ease;
  z-index: 9999; white-space: nowrap;
}
.badge-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.badge-toast-icon { font-size: 1.6rem; font-family: 'Frank Ruhl Libre', serif; }

/* ── Landscape phone ── */
@media (orientation: landscape) and (max-height: 500px) {
  #questionArea { padding: 8px 0 12px; gap: 12px; min-height: auto; }
  .quiz-question { display: flex; align-items: center; gap: 16px; }
  .quiz-prompt { margin-bottom: 0; }
  .quiz-tabs { margin-bottom: 8px; }
  .quiz-progress-bar { margin-bottom: 8px; }
}

/* ── Bigger on desktop ── */
@media (min-width: 700px) {
  .qz-shell { max-width: 640px; }
  .quiz-symbol-display { width: min(34vw, 240px); height: min(34vw, 240px); }
  .hebrew { font-size: min(18vw, 90px); }
  .quiz-options { max-width: 480px; }
  .matching-grid { max-width: 480px; }
  .quiz-symbol-opt { height: 120px; }
  .quiz-symbol-opt .hebrew-md { width: 88px; height: 88px; }
  .hebrew-md { font-size: clamp(1.8rem, 4vw, 2.6rem); }
}
