/* =====================================================================
   Study Modules — visual style
   ===================================================================== */

/* ---------- Homepage cluster (module preview cards) ---------- */
.study-cluster { padding: 60px 0; background: #f7fafc; }
.study-cluster .container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.study-cluster-head { text-align: center; margin-bottom: 40px; }
.study-cluster-head .eyebrow {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-teal);
  margin-bottom: 6px;
}
.study-cluster-head h2 {
  font-size: 32px;
  color: var(--brand-navy);
  margin: 4px 0 6px;
}
.study-cluster-head p {
  max-width: 620px;
  margin: 0 auto;
  color: var(--ink-soft);
}

.study-modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  margin-top: 30px;
}
.study-module-card {
  background: white;
  border: 1px solid #e2e8ee;
  border-radius: 12px;
  padding: 22px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.study-module-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(23,43,77,0.09);
  border-color: var(--brand-teal);
}
.study-module-card .study-mod-icon {
  font-size: 34px;
  line-height: 1;
}
.study-module-card h3 {
  font-family: var(--font-head);
  font-size: 18px;
  color: var(--brand-navy);
  margin: 0;
}
.study-module-card p {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.45;
}
.study-module-card .study-mod-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed #e2e8ee;
  font-size: 12px;
  color: var(--ink-soft);
  font-family: var(--font-mono, monospace);
}
.study-module-card .study-mod-cta {
  color: var(--brand-teal);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Study screen: header + module list ---------- */
#screen-study { padding: 32px 0 60px; }
.study-hero {
  background: linear-gradient(135deg, #f4f8fb 0%, #e9f2f7 100%);
  border-bottom: 1px solid #d6e2ea;
  padding: 30px 0 26px;
  margin-bottom: 30px;
}
.study-hero .container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.study-hero .eyebrow {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-teal);
}
.study-hero h1 {
  font-size: 30px;
  color: var(--brand-navy);
  margin: 4px 0 6px;
}
.study-hero p { color: var(--ink-soft); max-width: 720px; }

/* Overall progress block */
.study-progress-block {
  background: white;
  border: 1px solid #d6e2ea;
  border-radius: 12px;
  padding: 18px 20px;
  margin-top: 18px;
}
.study-progress-block-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.study-progress-block-title strong {
  font-family: var(--font-head);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-navy);
}
.study-progress-block-num {
  font-family: var(--font-mono, monospace);
  font-size: 14px;
  font-weight: 700;
  color: var(--brand-navy);
}
.study-progress-bar-track {
  width: 100%;
  height: 10px;
  background: rgba(23,43,77,0.08);
  border-radius: 999px;
  overflow: hidden;
}
.study-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-teal) 0%, #12b886 100%);
  border-radius: 999px;
  transition: width 0.6s ease-out;
}
.study-progress-bar-fill.perfect {
  background: linear-gradient(90deg, #12b886 0%, #ffd43b 100%);
  box-shadow: 0 0 10px rgba(255,212,59,0.4);
}

/* Module list on the Study screen */
.study-container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.study-modules-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.study-list-card {
  background: white;
  border: 1px solid #e2e8ee;
  border-left: 4px solid var(--brand-teal);
  border-radius: 12px;
  padding: 24px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.study-list-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(23,43,77,0.08); }
.study-list-card .study-list-icon { font-size: 32px; }
.study-list-card h3 { color: var(--brand-navy); margin: 0; font-size: 20px; }
.study-list-card .study-list-sub { font-size: 13px; color: var(--ink-soft); margin: 0; }
.study-list-card .study-list-desc { font-size: 14px; color: var(--ink); line-height: 1.5; margin: 4px 0 8px; }
.study-list-card .study-list-decks {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.study-list-card .study-deck-chip {
  font-size: 12px;
  font-family: var(--font-mono, monospace);
  background: #f4f8fb;
  border: 1px solid #d6e2ea;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--ink-soft);
}
.study-list-card .study-list-progress {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px dashed #e2e8ee;
}
.study-list-card .study-list-progress-num {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}
.study-list-card .study-list-progress-track {
  width: 100%; height: 6px; background: rgba(23,43,77,0.08); border-radius: 999px; overflow: hidden;
}
.study-list-card .study-list-progress-fill {
  height: 100%; background: var(--brand-teal); border-radius: 999px;
  transition: width 0.6s ease-out;
}
.study-list-card .study-list-progress-fill.perfect { background: linear-gradient(90deg, #12b886 0%, #ffd43b 100%); }
.study-list-card.coming-soon { opacity: 0.65; border-left-color: #cbd5db; cursor: not-allowed; }
.study-list-card.coming-soon:hover { transform: none; box-shadow: none; }

/* ---------- Deck picker (inside a module) ---------- */
.study-back-link {
  display: inline-block;
  color: var(--brand-teal);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  margin-bottom: 12px;
  user-select: none;
}
.study-back-link:hover { color: var(--brand-navy); }

.study-deck-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.study-deck-card {
  background: white;
  border: 1px solid #e2e8ee;
  border-radius: 10px;
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.study-deck-card:hover { border-color: var(--brand-teal); box-shadow: 0 4px 12px rgba(23,43,77,0.06); }
.study-deck-card h4 { color: var(--brand-navy); margin: 0; font-size: 17px; }
.study-deck-card .study-deck-desc { color: var(--ink-soft); font-size: 13px; margin: 0; }
.study-deck-card .study-deck-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--ink-soft); font-family: var(--font-mono, monospace);
  margin-top: auto; padding-top: 10px; border-top: 1px dashed #e2e8ee;
}
.study-deck-card .study-deck-status.complete { color: #1f7a3f; font-weight: 700; }
.study-deck-card .study-deck-status.inprogress { color: #a17510; font-weight: 700; }
.study-deck-card.empty {
  opacity: 0.6; cursor: default;
  border-style: dashed;
}
.study-deck-card.empty:hover { box-shadow: none; border-color: #e2e8ee; }

/* ---------- Quiz engine ---------- */
.study-quiz {
  max-width: 720px;
  margin: 0 auto;
  background: white;
  border: 1px solid #e2e8ee;
  border-radius: 14px;
  padding: 32px;
}
.study-quiz-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid #e2e8ee;
  padding-bottom: 16px;
  margin-bottom: 24px;
}
.study-quiz-head h2 { color: var(--brand-navy); margin: 0 0 4px; font-size: 22px; }
.study-quiz-head .study-quiz-sub { color: var(--ink-soft); font-size: 13px; margin: 0; }
.study-quiz-progress {
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 600;
}
.study-quiz-track {
  width: 100%;
  height: 4px;
  background: rgba(23,43,77,0.08);
  border-radius: 999px;
  overflow: hidden;
  margin: 6px 0 24px;
}
.study-quiz-track .study-quiz-fill {
  height: 100%;
  background: var(--brand-teal);
  transition: width 0.4s ease-out;
}

.study-item-prompt {
  font-size: 20px;
  color: var(--brand-navy);
  line-height: 1.4;
  margin: 0 0 20px;
  font-weight: 600;
}
.study-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}
.study-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border: 2px solid #e2e8ee;
  border-radius: 10px;
  background: white;
  text-align: left;
  cursor: pointer;
  font-size: 15px;
  color: var(--ink);
  transition: all 0.12s ease;
  width: 100%;
  font-family: inherit;
}
.study-choice:hover:not(:disabled) { border-color: var(--brand-teal); background: #f4fbfd; }
.study-choice.selected { border-color: var(--brand-teal); background: #e8f6f8; }
.study-choice.correct { border-color: #12b886; background: #dff4e6; color: #0e5c3d; }
.study-choice.wrong { border-color: #dc3545; background: #fde8ea; color: #7a1e28; }
.study-choice:disabled { cursor: default; }
.study-choice-letter {
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  font-size: 14px;
  min-width: 22px;
  color: var(--brand-teal);
}
.study-choice.correct .study-choice-letter { color: #12b886; }
.study-choice.wrong .study-choice-letter { color: #dc3545; }

/* Flashcard (flip animation) */
.study-flashcard {
  perspective: 1000px;
  height: 260px;
  margin: 0 0 24px;
}
.study-flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}
.study-flashcard.flipped .study-flashcard-inner { transform: rotateY(180deg); }
.study-flashcard-face {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  border: 2px solid #d6e2ea;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  backface-visibility: hidden;
}
.study-flashcard-face.front { background: #f4f8fb; }
.study-flashcard-face.back  { background: white; transform: rotateY(180deg); border-color: var(--brand-teal); }
.study-flashcard-label {
  font-family: var(--font-head);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.study-flashcard-content { font-size: 22px; color: var(--brand-navy); font-weight: 600; line-height: 1.4; }
.study-flashcard-hint { font-size: 13px; color: var(--ink-soft); margin-top: 10px; font-style: italic; }

/* Text input for short-answer */
.study-short-input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid #d6e2ea;
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  margin-bottom: 24px;
}
.study-short-input:focus { outline: none; border-color: var(--brand-teal); box-shadow: 0 0 0 3px rgba(23,162,184,0.15); }

/* Bottom controls */
.study-quiz-actions {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid #e2e8ee;
}
.study-quiz-actions .study-btn-group { display: flex; gap: 8px; }

.study-btn {
  padding: 10px 22px;
  border-radius: 8px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.12s ease;
  border: 2px solid transparent;
  background: var(--brand-teal);
  color: white;
}
.study-btn:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-1px); }
.study-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.study-btn-ghost { background: white; color: var(--brand-navy); border-color: #d6e2ea; }
.study-btn-ghost:hover:not(:disabled) { border-color: var(--brand-teal); color: var(--brand-teal); }

/* ---------- Final results screen ---------- */
.study-results {
  max-width: 720px;
  margin: 0 auto;
  background: white;
  border: 1px solid #e2e8ee;
  border-radius: 14px;
  padding: 32px;
  text-align: center;
}
.study-results h2 { color: var(--brand-navy); margin: 0 0 6px; font-size: 26px; }
.study-results .study-results-score {
  font-family: var(--font-head);
  font-size: 56px;
  font-weight: 800;
  color: var(--brand-navy);
  line-height: 1;
  margin: 20px 0 6px;
}
.study-results .study-results-pct { font-size: 22px; color: var(--brand-teal); font-weight: 700; margin-bottom: 4px; }
.study-results .study-results-stars {
  display: flex; justify-content: center; gap: 4px;
  font-size: 40px; margin: 12px 0 8px; letter-spacing: 2px;
}
.study-results .study-results-stars .star-on {
  color: #ffd43b;
  text-shadow: 0 0 12px rgba(255,212,59,0.6);
  animation: starPop 0.5s ease-out backwards;
}
.study-results .study-results-stars .star-on:nth-child(1) { animation-delay: 0.15s; }
.study-results .study-results-stars .star-on:nth-child(2) { animation-delay: 0.35s; }
.study-results .study-results-stars .star-on:nth-child(3) { animation-delay: 0.55s; }
.study-results .study-results-stars .star-off { color: #d0d7de; }
.study-results .study-results-note {
  color: var(--ink-soft);
  margin: 0 0 24px;
  font-size: 14px;
}
.study-results-review {
  text-align: left;
  border-top: 1px solid #e2e8ee;
  padding-top: 20px;
  margin-top: 20px;
}
.study-results-review h3 { color: var(--brand-navy); margin: 0 0 14px; font-size: 16px; }
.study-review-item {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px dashed #e2e8ee;
}
.study-review-item:last-child { border-bottom: none; }
.study-review-mark {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: white;
  flex-shrink: 0;
  margin-top: 2px;
}
.study-review-mark.correct { background: #12b886; }
.study-review-mark.wrong { background: #dc3545; }
.study-review-body { flex: 1; }
.study-review-body .study-review-prompt { font-weight: 600; color: var(--brand-navy); font-size: 14px; margin-bottom: 4px; }
.study-review-body .study-review-answer {
  font-size: 13px; color: var(--ink-soft);
}
.study-review-body .study-review-answer strong { color: #0e5c3d; }
.study-review-body .study-review-rationale {
  font-size: 13px; color: var(--ink); margin-top: 4px; padding: 8px 10px;
  background: #f4f8fb; border-left: 3px solid var(--brand-teal); border-radius: 4px;
}

.study-actions-bottom {
  display: flex; justify-content: center; gap: 10px;
  margin-top: 24px; padding-top: 20px; border-top: 1px solid #e2e8ee;
}

@media (max-width: 640px) {
  .study-quiz { padding: 22px; }
  .study-flashcard { height: 220px; }
  .study-item-prompt { font-size: 18px; }
  .study-flashcard-content { font-size: 18px; }
}

/* ============================================================
 * Enhancement Layer: audio scenarios, image MCs, sequences, memory match
 * ============================================================ */

/* --- Audio scenario card --- */
.study-audio-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 20px;
  margin: 16px 0 20px;
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  border: 1px solid #bae6fd;
  border-radius: 14px;
}
.study-audio-icon {
  font-size: 34px;
  line-height: 1;
  color: #0369a1;
  padding-top: 4px;
}
.study-audio-body { flex: 1; min-width: 0; }
.study-audio-label {
  font-size: 13px;
  font-weight: 600;
  color: #0369a1;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.study-audio-body audio { display: block; }
.study-audio-transcript {
  margin-top: 10px;
  padding: 10px 12px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-size: 13px;
  color: var(--ink-soft, #475569);
}
.study-audio-transcript summary {
  cursor: pointer;
  font-weight: 600;
  color: #0369a1;
  padding: 2px 0;
}
.study-audio-transcript p { margin: 8px 0 0; line-height: 1.55; }

/* --- Image MC frame --- */
.study-image-frame {
  margin: 12px 0 18px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  display: flex;
  justify-content: center;
}
.study-image-frame img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

/* --- Sequence (order-of-draw) --- */
.study-sequence-help {
  font-size: 13px;
  color: var(--ink-soft, #475569);
  margin: -4px 0 12px;
}
.study-sequence-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 68px;
  padding: 12px;
  margin-bottom: 16px;
  background: #fefce8;
  border: 2px dashed #eab308;
  border-radius: 12px;
  align-items: center;
}
.study-sequence-empty {
  color: #a16207;
  font-size: 13px;
  font-style: italic;
  padding: 8px;
  width: 100%;
  text-align: center;
}
.study-sequence-slot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #ffffff;
  border: 2px solid #eab308;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  color: #0f172a;
  transition: transform .15s ease, box-shadow .15s ease;
}
.study-sequence-slot:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(234,179,8,.2); }
.study-sequence-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  background: #0d5e7f;
  color: #ffffff;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
}
.study-sequence-thumb { width: 22px; height: 32px; border-radius: 3px; object-fit: contain; }
.study-sequence-thumb-lg { width: 42px; height: 60px; border-radius: 4px; object-fit: contain; }
.study-sequence-x { color: #94a3b8; font-size: 18px; margin-left: 4px; }
.study-sequence-label { font-weight: 500; }
.study-sequence-pool-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft, #475569);
  margin-bottom: 8px;
}
.study-sequence-pool {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.study-sequence-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: #0f172a;
  transition: all .15s ease;
}
.study-sequence-item:hover {
  border-color: var(--brand-teal, #0d7a68);
  background: #f4fbfd;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(13,122,104,.15);
}

/* --- Memory match game --- */
.study-match-status {
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--ink-soft, #475569);
  text-align: center;
}
.study-match-done {
  display: inline-block;
  padding: 2px 10px;
  background: #dff4e6;
  color: #0e5c3d;
  border-radius: 999px;
  font-weight: 700;
}
.study-match-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (max-width: 640px) {
  .study-match-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}
.study-match-card {
  aspect-ratio: 3 / 4;
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  perspective: 700px;
  font-family: inherit;
}
.study-match-card:disabled { cursor: default; }
.study-match-inner {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
  border-radius: 10px;
}
.study-match-card.flipped .study-match-inner {
  transform: rotateY(180deg);
}
.study-match-back,
.study-match-front {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  text-align: center;
  font-size: 13px;
  line-height: 1.35;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.study-match-back {
  background: linear-gradient(135deg, #0d5e7f, #0d7a68);
  color: #ffffff;
  font-size: 32px;
  font-weight: 700;
}
.study-match-front {
  transform: rotateY(180deg);
  background: #ffffff;
  color: #0f172a;
  border: 2px solid #cbd5e1;
  font-weight: 600;
}
.study-match-card.term .study-match-front {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #075985;
}
.study-match-card.match .study-match-front {
  background: #ede9fe;
  border-color: #c4b5fd;
  color: #5b21b6;
}
.study-match-card.matched .study-match-front {
  background: #dcfce7;
  border-color: #86efac;
  color: #14532d;
  animation: matchPulse .5s ease;
}
@keyframes matchPulse {
  0% { transform: rotateY(180deg) scale(1); }
  50% { transform: rotateY(180deg) scale(1.06); }
  100% { transform: rotateY(180deg) scale(1); }
}
