/* ==========================================================================
   Extra Exercises & 6-Step Lesson Styles (lessons.htm, lesson.htm,
   and lesson-exercises.htm)
   ========================================================================== */

.lesson-hub-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lesson-ex-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #26547c;
  text-decoration: none;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(38, 84, 124, 0.09);
  border: 1px solid rgba(38, 84, 124, 0.24);
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.lesson-ex-link:hover {
  background: rgba(38, 84, 124, 0.17);
  border-color: #26547c;
  text-decoration: none;
  transform: translateY(-1px);
}

.lesson-extra-grid {
  margin-top: 0;
}

.lesson-extra-card {
  border-color: rgba(38, 84, 124, 0.32);
  background: linear-gradient(135deg, rgba(38, 84, 124, 0.07), var(--bg-surface) 62%);
}

.lesson-extra-card:hover {
  border-color: #26547c;
}

.lesson-extra-copy {
  flex: 1 1 auto;
}

.lesson-extra-cta {
  display: inline-flex;
  align-items: center;
  padding: 6px 13px;
  border-radius: 999px;
  background: #26547c;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

/* 6-Step Lesson Sections & Scoped Visibility Toggles */
.lesson-step-section {
  scroll-margin-top: 132px;
}

.lesson-detail-stack.hide-lesson-romaji .lesson-romaji-el,
.lesson-detail-stack.hide-lesson-romaji .sb-opt-romaji,
.lesson-detail-stack.hide-lesson-romaji .sb-romaji-full {
  display: none !important;
}

.lesson-detail-stack.hide-lesson-en .lesson-en-el {
  display: none !important;
}

/* Step 1: Tap & Listen cards under theme-lessons */
body.theme-lessons .kid-word-card {
  cursor: pointer;
}

body.theme-lessons .kid-word-card:hover {
  border-color: #26547c;
}

body.theme-lessons .kid-word-card.is-learned {
  border-color: var(--accent-matcha);
}

body.theme-lessons .kid-word-card .greeting-romaji {
  color: #26547c;
}

/* 'i' Word Info button on Step 1 cards (inspired by hiragana.htm .tile-info-btn) */
.lesson-word-info-btn {
  position: static;
  margin-left: auto;
  width: 26px;
  height: 26px;
  font-size: 0.78rem;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  border: 1.5px solid rgba(38, 84, 124, 0.28);
  background: var(--bg-surface);
  color: #26547c;
  cursor: pointer;
  flex-shrink: 0;
}

.lesson-word-info-btn:hover {
  border-color: #26547c;
  background: #26547c;
  color: #ffffff;
}

/* Word Inspector Modal */
.lesson-word-modal-dialog {
  max-width: 600px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.lesson-word-modal-dialog .modal-body {
  overflow-y: auto;
}

.lesson-word-modal-hero {
  align-items: center;
}

/* All 3 Writing Systems Cards */
.lesson-word-scripts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.lesson-script-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-light);
  background: var(--bg-page);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.lesson-script-card:hover:not(:disabled) {
  border-color: #26547c;
  transform: translateY(-1px);
}

.lesson-script-card.active {
  border-color: #26547c;
  background: rgba(38, 84, 124, 0.1);
  box-shadow: 0 0 0 2px rgba(38, 84, 124, 0.16);
}

.lesson-script-card.is-empty,
.lesson-script-card:disabled {
  opacity: 0.55;
  cursor: default;
}

.lesson-script-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}

.lesson-script-val {
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.3;
  word-break: break-word;
}

/* Multi-character Animated Word Stroke Stage */
.lesson-word-stroke-block {
  margin-bottom: 12px;
}

.lesson-word-stroke-stage {
  margin: 8px 0 10px;
}

.word-stroke-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.word-stroke-box {
  width: 88px;
  height: 88px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-light);
  background: #ffffff;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.word-stroke-strip.is-compact .word-stroke-box {
  width: 72px;
  height: 72px;
}

.word-stroke-box:hover {
  border-color: #26547c;
  transform: translateY(-1px);
}

.word-stroke-box.is-writing {
  border-color: var(--accent-vermilion);
  box-shadow: 0 0 0 3px rgba(200, 62, 55, 0.18);
}

.word-stroke-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.lesson-word-stroke-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

@media (max-width: 520px) {
  .lesson-word-scripts-grid {
    grid-template-columns: 1fr;
  }

  .word-stroke-box {
    width: 72px;
    height: 72px;
  }
}

.lesson-word-glyph-box {
  width: auto;
  min-width: 118px;
  max-width: 195px;
  min-height: 98px;
  height: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
}

.lesson-word-modal-emoji {
  font-size: 1.35rem;
  line-height: 1;
}

.lesson-word-modal-jp {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.25;
  word-break: keep-all;
}

.lesson-word-modal-en {
  font-size: 1rem;
  font-weight: 700;
  color: #26547c;
  margin: 2px 0 4px;
}

.lesson-word-kanji-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lesson-word-kanji-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  background: rgba(138, 90, 25, 0.09);
  border: 1px solid rgba(138, 90, 25, 0.28);
  font-size: 1.45rem;
  font-weight: 700;
  white-space: nowrap;
}

.lesson-word-kanji-note {
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.lesson-word-beats {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  margin-bottom: 6px;
  border-radius: var(--radius-sm);
  background: rgba(38, 84, 124, 0.08);
  font-size: 0.86rem;
  font-weight: 700;
  color: #1b3f5e;
}

.lesson-word-ex-jp {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.lesson-word-ex-romaji {
  font-size: 0.82rem;
  font-weight: 600;
  color: #26547c;
}

.lesson-word-ex-en {
  font-size: 0.83rem;
  color: var(--text-secondary);
}

.lesson-word-modal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lesson-word-modal-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Step 2: Sentence Builder spacing inside card-panel */
#lessonSentenceBuilder .sb-shell {
  margin-top: 4px;
}

/* Step 4: Flashcards spacing inside card-panel */
#lessonFlashcards .fc-shell {
  margin-top: 4px;
}

/* Step 6: Two-part You Got This! Quiz */
.lesson-fun-quiz-card {
  margin-top: 4px;
  box-shadow: none;
  border: 1.5px solid var(--border-light);
}

.lesson-grammar-check-wrap {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1.5px dashed var(--border-light);
}

.lesson-grammar-check-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.lesson-grammar-check-head h3 {
  margin: 0;
  font-size: 1.04rem;
  color: var(--text-primary);
}

body.theme-lessons .ex-num-badge {
  background: #26547c;
}

body.theme-lessons .ex-letter {
  color: #26547c;
}

@media (max-width: 600px) {
  .lesson-extra-card {
    flex-wrap: wrap;
  }

  .lesson-extra-cta {
    margin-left: auto;
  }
}

/* ==========================================================================
   Extended Exercises (13–21) Styles — Part Banners, Sylla-Bees, True/False,
   Spelling, Jumble, Faulty Translation, Kana Symbols & Break the Code
   ========================================================================== */
.ex-part-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 28px 0 14px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(38, 84, 124, 0.12), rgba(246, 241, 232, 0.8));
  border: 1.5px solid rgba(38, 84, 124, 0.25);
  border-left: 6px solid #26547c;
  scroll-margin-top: 132px;
}

.ex-part-banner:first-child {
  margin-top: 0;
}

.ex-part-icon {
  font-size: 1.7rem;
  line-height: 1;
  flex-shrink: 0;
}

.ex-part-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #26547c;
}

.ex-part-banner h3 {
  margin: 2px 0 2px;
  font-size: 1.15rem;
  color: var(--text-primary);
}

.ex-part-section-name {
  color: #26547c;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.ex-part-sub {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.subnav-group-pill {
  background: #26547c !important;
  color: #ffffff !important;
  border-color: #26547c !important;
  font-weight: 800 !important;
  letter-spacing: 0.02em;
}

.subnav-group-pill:hover {
  background: #1b3f5e !important;
  color: #ffffff !important;
}

/* Exercise 13: Sylla-Bees Honeycomb */
.syllabee-item {
  display: grid;
  grid-template-columns: minmax(210px, 260px) 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px;
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-page);
  border: 1.5px solid var(--border-light);
}

.syllabee-hive-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.syllabee-bee-svg {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
}

.syllabee-hex-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.syllabee-hex {
  min-width: 46px;
  height: 42px;
  padding: 0 10px;
  border: 2px solid #c9971c;
  background: #fff8dc;
  color: #1f1d1b;
  font-weight: 800;
  font-size: 0.88rem;
  clip-path: polygon(16% 0%, 84% 0%, 100% 50%, 84% 100%, 16% 100%, 0% 50%);
  cursor: pointer;
  transition: transform 0.14s ease, background 0.14s ease, opacity 0.14s ease;
}

.syllabee-hex:hover:not(:disabled) {
  background: #f7c948;
  transform: scale(1.06);
}

.syllabee-hex:disabled {
  opacity: 0.32;
  cursor: default;
}

.syllabee-target-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.syllabee-slots {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1.5px dashed var(--border-strong);
}

.syllabee-slots.is-correct {
  border-color: var(--accent-matcha);
  background: var(--bg-matcha-soft);
}

.syllabee-slots.is-wrong {
  border-color: var(--accent-vermilion);
  background: var(--bg-accent-soft);
}

.syllabee-word-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.syllabee-slash {
  font-weight: 800;
  color: var(--text-muted);
  margin: 0 3px;
}

.syllabee-slot {
  min-width: 38px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1.5px solid var(--border-light);
  background: var(--bg-page);
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.syllabee-slot.is-filled {
  border-color: #c9971c;
  background: #fff8dc;
  color: #1f1d1b;
  cursor: pointer;
}

/* Exercise 14: True/False Dialogue Bubbles */
.tf-bubbles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.tf-bubble {
  padding: 11px 13px;
  border-radius: var(--radius-md);
  background: var(--bg-page);
  border: 1.5px solid var(--border-light);
}

.tf-bubble-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.tf-bubble-top .mini-listen-btn {
  margin-left: auto;
}

.tf-bubble-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: #26547c;
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 800;
}

.tf-bubble-speaker {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.tf-bubble-jp {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.38;
}

.tf-bubble-romaji {
  font-size: 0.82rem;
  font-weight: 600;
  color: #26547c;
  margin-top: 2px;
}

/* Exercises 15, 16, 17, 19, 20, 21 Inputs */
.ex-char-input {
  width: 42px;
  padding: 4px 4px;
}

.ex-kana-input {
  width: 48px;
  font-family: var(--font-jp);
  font-size: 1.05rem;
}

.ex-jumbled-code {
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(38, 84, 124, 0.09);
  color: #1b3f5e;
  font-weight: 700;
  font-size: 0.9rem;
}

.ex-sentence-input {
  flex: 1 1 210px;
  min-width: 180px;
}

.ex-faulty-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-page);
  border: 1px solid var(--border-light);
}

.ex-faulty-jp {
  min-width: 170px;
}

.ex-faulty-jp .jp {
  font-size: 1rem;
  font-weight: 700;
}

.ex-faulty-jp small {
  color: #26547c;
  font-weight: 600;
}

.ex-faulty-wrong {
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(200, 62, 55, 0.1);
  color: var(--accent-vermilion);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: line-through;
}

.ex-faulty-arrow {
  font-weight: 800;
  color: var(--text-muted);
}

.ex-kana-word-wrap {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 3px;
  font-size: 1.12rem;
  font-weight: 700;
}

.ex-ruby-blank {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 0 2px;
}

.ex-ruby-hint {
  font-family: var(--font-sans, Inter, sans-serif);
  font-size: 0.7rem;
  font-weight: 700;
  color: #26547c;
  line-height: 1;
}

/* Exercise 20: Break the Code */
.ex-code-table-wrap {
  overflow-x: auto;
}

.ex-code-table th,
.ex-code-table td {
  text-align: center;
  min-width: 54px;
}

.ex-code-item {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ex-code-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ex-code-jp {
  font-size: 1.18rem;
  letter-spacing: 0.03em;
}

.ex-code-bold {
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ex-code-grey {
  opacity: 0.58;
  font-weight: 500;
}

.ex-code-decode,
.ex-code-trans {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.ex-code-sub {
  font-size: 0.78rem;
  font-weight: 800;
  color: #26547c;
  min-width: 92px;
}

.ex-code-given {
  font-weight: 600;
  color: var(--text-secondary);
}

.ex-code-input {
  width: 56px;
  padding: 3px 6px;
}

.ex-code-select {
  flex: 1 1 240px;
  max-width: 420px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-surface);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.ex-code-select.is-correct {
  border-color: var(--accent-matcha);
  background: var(--bg-matcha-soft);
  color: var(--accent-matcha);
}

.ex-code-select.is-wrong {
  border-color: var(--accent-vermilion);
  background: var(--bg-accent-soft);
  color: var(--accent-vermilion);
}

@media (max-width: 720px) {
  .syllabee-item {
    grid-template-columns: 1fr;
  }
}
