/* Survival English for Travel — hub + unit pages (reader stack) */

/* Body scroll (same pattern as be-page / expressions-page): default reader locks height */
body.reader.ts-page {
  height: auto;
  min-height: 100dvh;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-family: "Tajawal", system-ui, sans-serif;
}

body.reader.ts-page .reader-flow {
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible;
}

body.reader.ts-page .reader-foot {
  flex-shrink: 0;
}

body.reader.ts-page .ts-dock {
  flex-shrink: 0;
}

/* Arabic-heavy page: Latin / UI chrome stays Outfit */
body.reader.ts-page .reader-logo,
body.reader.ts-page .reader-fs-btn,
body.reader.ts-page .reader-h1-en,
body.reader.ts-page .ts-level__meta,
body.reader.ts-page .ts-line-en,
body.reader.ts-page .ts-hub-card__num,
body.reader.ts-page .ts-hub-card__en {
  font-family: var(--font-ui), system-ui, sans-serif;
}

body.reader.ts-page .word-lab-article .reader-h1 {
  font-family: "Tajawal", system-ui, sans-serif;
  font-weight: 800;
}

body.reader.ts-page .word-lab-article .reader-h1-en {
  margin: 0 0 14px;
  font-family: var(--font-ui), system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-soft, #64748b);
  direction: ltr;
  text-align: left;
}

body.reader.ts-page .word-lab-article {
  width: 100%;
  max-width: 44rem;
  margin-inline: auto;
  padding: clamp(16px, 3vw, 28px) var(--reader-inset);
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

body.reader.ts-page .word-lab-home-link {
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  color: #0f766e;
  border-bottom: 1px dashed rgba(15, 118, 110, 0.4);
}

body.reader.ts-page .word-lab-home-link:hover {
  color: var(--ink, #0f172a);
}

/* Hub uses .be-toc without business-english.css */
body.reader.ts-page .be-toc {
  margin: 0 0 22px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line, #e2d4c2);
  border-radius: var(--radius, 12px);
  box-shadow: var(--shadow, 0 14px 36px rgba(44, 40, 37, 0.07));
}

body.reader.ts-page .be-toc h2 {
  margin: 0 0 10px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ink, #0f172a);
  direction: rtl;
  text-align: right;
}

body.reader.ts-page .be-toc ul {
  margin: 0;
  padding: 0 1.1rem 0 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  direction: rtl;
}

body.reader.ts-page .be-toc li {
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--ink-soft, #64748b);
}

body.reader.ts-page .be-toc a {
  color: #0f766e;
  text-decoration: none;
  border-bottom: 1px dashed rgba(15, 118, 110, 0.35);
  font-family: "Tajawal", system-ui, sans-serif;
}

body.reader.ts-page .be-toc a:hover {
  color: var(--ink, #0f172a);
}

body.reader.ts-page .be-badge {
  font-family: var(--font-ui), system-ui, sans-serif;
}

.ts-page .reader-h1 {
  margin-bottom: 0.35rem;
}

.ts-level__tip:empty,
.ts-practice-lede:empty {
  display: none;
}

.ts-hero-note {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(224, 242, 254, 0.95), rgba(254, 252, 232, 0.9));
  border: 1px solid rgba(14, 116, 144, 0.25);
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.55;
  color: #334155;
  direction: rtl;
  text-align: right;
}

.ts-dock {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  justify-content: center;
  margin: 0 0 18px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: var(--shadow, 0 1px 8px rgba(15, 23, 42, 0.06));
}

.ts-dock a {
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  text-decoration: none;
  color: #0c4a6e;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(224, 242, 254, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.ts-dock a:hover {
  background: rgba(125, 211, 252, 0.45);
}

.ts-dock a[aria-current="page"] {
  background: linear-gradient(90deg, #0369a1, #0284c7);
  color: #f0f9ff;
  border-color: #0369a1;
}

.ts-hub-grid {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
}

@media (min-width: 520px) {
  .ts-hub-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .ts-hub-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.ts-hub-card {
  display: block;
  padding: 14px 16px;
  border-radius: 14px;
  text-decoration: none;
  border: 1px solid rgba(14, 165, 233, 0.28);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow, 0 1px 8px rgba(15, 23, 42, 0.06));
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.ts-hub-card:hover {
  transform: translateY(-2px);
  border-color: #0284c7;
}

.ts-hub-card__num {
  display: inline-block;
  margin-bottom: 8px;
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #0369a1;
}

.ts-hub-card__ar {
  display: block;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ink, #0f172a);
  direction: rtl;
  text-align: right;
}

.ts-hub-card__en {
  display: block;
  margin-top: 6px;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft, #64748b);
  direction: ltr;
  text-align: left;
}

.ts-hub-card__hint {
  margin: 10px 0 0;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.45;
  color: #64748b;
  direction: rtl;
  text-align: right;
}

/* One unit = Q&A block + flowing conversation (no difficulty levels) */
.ts-unit-qna,
.ts-unit-flow {
  margin: 0 0 28px;
  padding: 18px 18px 20px;
  border-radius: var(--radius, 14px);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: var(--shadow, 0 1px 8px rgba(15, 23, 42, 0.06));
}

.word-lab-article > section:last-of-type {
  margin-bottom: 0;
}

.ts-unit-qna {
  border-inline-start: 4px solid #0d9488;
}

.ts-unit-flow--actual {
  border-inline-start: 4px solid #2563eb;
}

.ts-unit-flow--beginner {
  border-inline-start: 4px solid #d97706;
  background: rgba(255, 251, 235, 0.45);
}

.ts-section-title {
  margin: 0 0 10px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--ink, #0f172a);
  direction: rtl;
  text-align: right;
}

.ts-section-lede {
  margin: 0 0 12px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.55;
  color: #475569;
  direction: rtl;
  text-align: right;
}

.ts-section-note {
  margin: 0 0 16px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(241, 245, 249, 0.85);
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.5;
  color: #64748b;
  direction: rtl;
  text-align: right;
}

.ts-qa-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ts-qa-group .ts-expr-group__title {
  margin-top: 6px;
  font-size: 0.88rem;
}

.ts-qa-card {
  padding: 12px 12px 14px;
  border-radius: 11px;
  background: rgba(240, 253, 250, 0.55);
  border: 1px solid rgba(45, 212, 191, 0.28);
}

.ts-qa-card--phrase {
  background: rgba(254, 252, 232, 0.65);
  border-color: rgba(234, 179, 8, 0.28);
}

.ts-qa-card--phrase .ts-qa-label {
  color: #b45309;
}

.ts-qa-label {
  margin: 0 0 6px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0f766e;
  direction: rtl;
  text-align: right;
}

.ts-qa-label--answer {
  margin-top: 10px;
  color: #b45309;
}

.ts-turn--break {
  text-align: center;
  background: rgba(248, 250, 252, 0.95);
  border: 1px dashed rgba(148, 163, 184, 0.65);
  border-inline-start-width: 1px;
}

.ts-turn--break .ts-speaker {
  font-size: 0.65rem;
  color: #64748b;
}

.ts-turn--break .ts-line-en,
.ts-turn--break .ts-line-ar {
  font-weight: 600;
  color: #475569;
  text-align: center;
}

/* Three levels per unit (legacy, unused in new layout) */
.ts-level {
  margin: 0 0 26px;
  padding: 18px 18px 20px;
  border-radius: var(--radius, 14px);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: var(--shadow, 0 1px 8px rgba(15, 23, 42, 0.06));
}

.ts-level:last-of-type {
  margin-bottom: 0;
}

.ts-level--1 {
  border-inline-start: 4px solid #0d9488;
}

.ts-level--2 {
  border-inline-start: 4px solid #2563eb;
}

.ts-level--3 {
  border-inline-start: 4px solid #7c3aed;
}

.ts-level__head {
  margin: 0 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.ts-level__badge {
  display: inline-block;
  margin-bottom: 8px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  padding: 4px 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #0f766e, #14b8a6);
}

.ts-level--2 .ts-level__badge {
  background: linear-gradient(90deg, #1d4ed8, #3b82f6);
}

.ts-level--3 .ts-level__badge {
  background: linear-gradient(90deg, #5b21b6, #7c3aed);
}

.ts-level__head h2 {
  margin: 0 0 6px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink, #0f172a);
  direction: rtl;
  text-align: right;
}

.ts-level__meta {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft, #64748b);
  direction: ltr;
  text-align: left;
}

.ts-level__tip {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.95);
  border: 1px solid rgba(226, 232, 240, 0.9);
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.52;
  color: #475569;
  direction: rtl;
  text-align: right;
}

/* Separate panels: vocabulary vs practice dialogue */
.ts-panel {
  margin: 0 0 14px;
  padding: 14px 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(255, 255, 255, 0.92);
}

.ts-panel:last-child {
  margin-bottom: 0;
}

.ts-panel--expr {
  background: linear-gradient(
    160deg,
    rgba(240, 253, 250, 0.85) 0%,
    rgba(224, 242, 254, 0.75) 100%
  );
  border-color: rgba(45, 212, 191, 0.35);
}

.ts-panel--conv {
  background: rgba(254, 252, 232, 0.82);
  border-color: rgba(234, 179, 8, 0.32);
}

.ts-panel__title {
  margin: 0 0 8px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.92rem;
  font-weight: 800;
  color: #0f172a;
  direction: rtl;
  text-align: right;
}

.ts-panel__lede {
  margin: 0 0 12px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.55;
  color: #475569;
  direction: rtl;
  text-align: right;
}

.ts-expr-group {
  margin: 0 0 16px;
}

.ts-expr-group:last-child {
  margin-bottom: 0;
}

.ts-expr-group__title {
  margin: 0 0 8px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 800;
  color: #0f766e;
  direction: rtl;
  text-align: right;
  letter-spacing: 0.01em;
}

.ts-level--2 .ts-expr-group__title {
  color: #1d4ed8;
}

.ts-level--3 .ts-expr-group__title {
  color: #5b21b6;
}

.ts-subh {
  margin: 0 0 10px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f172a;
  direction: rtl;
  text-align: right;
}

.ts-expr-block {
  margin-bottom: 18px;
}

.ts-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ts-list li {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(240, 249, 255, 0.65);
  border: 1px solid rgba(125, 211, 252, 0.35);
}

.ts-line-en {
  margin: 0 0 4px;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.45;
  color: #0f172a;
  direction: ltr;
  text-align: left;
}

.ts-line-ar {
  margin: 0;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.5;
  color: #64748b;
  direction: rtl;
  text-align: right;
}

.ts-practice-block {
  margin: 0;
  padding: 14px;
  border-radius: 12px;
  background: rgba(254, 252, 232, 0.75);
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.ts-practice-lede {
  margin: 0 0 12px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.5;
  color: #713f12;
  direction: rtl;
  text-align: right;
}

.ts-dialogue {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ts-turn {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(251, 191, 36, 0.25);
}

.ts-turn--you {
  border-inline-start: 3px solid #16a34a;
}

.ts-turn--local {
  border-inline-start: 3px solid #0284c7;
}

.ts-speaker {
  margin: 0 0 6px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  color: #0f172a;
  direction: rtl;
  text-align: right;
}

/* English-only replay + hard-word glosses (below bilingual dialogue) */
.ts-conv-solo {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed rgba(202, 138, 4, 0.45);
}

.ts-conv-solo__title {
  margin: 0 0 6px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.84rem;
  font-weight: 800;
  color: #78350f;
  direction: rtl;
  text-align: right;
}

.ts-conv-solo__lede {
  margin: 0 0 10px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.5;
  color: #92400e;
  direction: rtl;
  text-align: right;
}

.ts-dialogue--en-only {
  margin-bottom: 14px;
}

.ts-dialogue--en-only .ts-turn--en-solo {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(59, 130, 246, 0.22);
}

.ts-line-en--solo {
  margin-bottom: 0;
  font-size: 0.82rem;
}

.ts-hard-words {
  margin: 0;
  padding: 12px 12px 14px;
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.96);
  border: 1px solid rgba(100, 116, 139, 0.32);
}

.ts-hard-words__title {
  margin: 0 0 6px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  color: #0f172a;
  direction: rtl;
  text-align: right;
}

.ts-hard-words__hint {
  margin: 0 0 10px;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.45;
  color: #64748b;
  direction: rtl;
  text-align: right;
}

.ts-hard-words__list {
  margin: 0;
  padding: 0;
}

.ts-hard-words__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 8px 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(226, 232, 240, 0.95);
}

.ts-hard-words__row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

@media (max-width: 520px) {
  .ts-hard-words__row {
    grid-template-columns: 1fr;
  }
}

.ts-hard-words__term {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.4;
  color: #0f172a;
}

.ts-hard-words__gloss {
  margin: 0;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.45;
  color: #475569;
}

.ts-hard-words__empty {
  margin: 0;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.45;
  color: #64748b;
  direction: rtl;
  text-align: right;
}

.ts-cross {
  margin: 22px 0 0;
  padding: 14px;
  border-radius: 12px;
  background: rgba(241, 245, 249, 0.9);
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.5;
  color: #334155;
  direction: rtl;
  text-align: right;
}

.ts-cross a {
  color: #0369a1;
  font-weight: 800;
}

/* Expression-only units: glossary block + jump to conversation */
.ts-unit-glossary {
  margin: 0 0 28px;
  padding: 18px 18px 20px;
  border-radius: var(--radius, 14px);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: var(--shadow, 0 1px 8px rgba(15, 23, 42, 0.06));
  border-inline-start: 4px solid #7c3aed;
}

.ts-hard-words--expr {
  background: rgba(245, 243, 255, 0.5);
  border-color: rgba(167, 139, 250, 0.35);
}

.ts-cross--jump {
  margin-top: 18px;
  padding: 14px 16px;
  background: linear-gradient(
    135deg,
    rgba(254, 252, 232, 0.95),
    rgba(224, 242, 254, 0.88)
  );
  border: 1px solid rgba(14, 116, 144, 0.2);
}

.ts-cross--jump a {
  font-size: 0.88rem;
}

.ts-unit-conv-page .ts-panel--conv {
  margin-top: 8px;
}

.ts-panel__lede--en {
  margin: 0 0 14px;
  font-family: var(--font-ui), system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.45;
  color: #475569;
}

.ts-dialogue--conv-main {
  margin-bottom: 4px;
}
