/* ============================================================================
   VISALINK LEARN — 9-IN-1 SUPER-APP LAUNCHER & D1 WORKSPACE CSS
   Google Play Organization TWA (vn.visalink.learn) • Strict CSP Clean • WCAG AA
   ============================================================================ */

:root {
  --lh-bg: #f4fbf5;
  --lh-surface: #ffffff;
  --lh-surface-alt: #edf8f0;
  --lh-border: #d3e5d8;
  --lh-text: #0f172a;
  --lh-muted: #475569;
  --lh-forest: #093915;
  --lh-emerald: #11692b;
  --lh-emerald-bright: #15803d;
  --lh-gold: #f5b82e;
  --lh-gold-bg: #fef9c3;
  --lh-crimson: #c8102e;
  --lh-shadow: 0 10px 28px rgba(9, 57, 21, 0.08);
}

[data-theme="dark"] {
  --lh-bg: #0a140e;
  --lh-surface: #112118;
  --lh-surface-alt: #172d21;
  --lh-border: #264735;
  --lh-text: #f1f5f9;
  --lh-muted: #cbd5e1;
  --lh-forest: #86efac;
  --lh-emerald: #22c55e;
  --lh-emerald-bright: #16a34a;
  --lh-gold-bg: #3b2f0c;
  --lh-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--lh-bg);
  color: var(--lh-text);
  line-height: 1.6;
}

.lh-hidden {
  display: none !important;
}

.lh-mt-10 {
  margin-top: 10px;
}

/* TOPBAR */
.lh-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(95deg, #093915 0%, #11692b 100%);
  border-bottom: 3px solid var(--lh-gold);
  padding: 10px 16px;
  color: #ffffff;
}

.lh-topbar-inner {
  max-width: 1220px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lh-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #ffffff;
}

.lh-brand img {
  height: 32px;
  width: auto;
  background: #ffffff;
  padding: 3px 8px;
  border-radius: 8px;
}

.lh-brand-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.lh-brand-title {
  font-weight: 900;
  font-size: 14.5px;
  letter-spacing: 0.03em;
}

.lh-brand-sub {
  font-size: 11px;
  color: #fde68a;
  font-weight: 700;
}

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

.lh-nav-pill {
  color: #ecfdf5;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  min-height: 38px;
  display: inline-flex;
  align-items: center;
}

.lh-nav-pill:hover {
  background: #fde68a;
  color: #093915;
}

.lh-nav-pill-gold {
  background: rgba(245, 184, 46, 0.24);
  border: 1px solid rgba(253, 230, 138, 0.65);
  color: #fef08a;
}

/* CONTAINER & BUTTONS */
.lh-container {
  max-width: 1220px;
  margin: 0 auto;
  padding: 22px 14px 64px;
}

.lh-btn {
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 999px;
  border: none;
  font: inherit;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  transition: transform 0.14s ease, opacity 0.14s ease;
}

.lh-btn:hover {
  transform: translateY(-1px);
}

.lh-btn-sm {
  min-height: 36px;
  padding: 6px 13px;
  font-size: 12.5px;
}

.lh-btn-crimson {
  background: var(--lh-crimson);
  color: #ffffff;
}

.lh-btn-emerald {
  background: #11692b;
  color: #ffffff;
}

.lh-btn-gold {
  background: var(--lh-gold);
  color: #093915;
}

.lh-btn-white {
  background: #ffffff;
  color: #093915;
}

.lh-btn-outline {
  background: var(--lh-surface);
  color: var(--lh-forest);
  border: 1.5px solid var(--lh-border);
}

.lh-btn-outline-light {
  background: transparent;
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
}

.lh-btn-ghost {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  min-height: 38px;
  padding: 7px 12px;
  font-size: 12.5px;
}

.lh-input {
  width: 100%;
  min-height: 42px;
  padding: 9px 13px;
  border-radius: 12px;
  border: 1.5px solid var(--lh-border);
  background: var(--lh-surface);
  color: var(--lh-text);
  font: inherit;
  font-size: 14px;
}

.lh-input-sm {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 13px;
}

/* HERO */
.lh-hero {
  background: linear-gradient(132deg, #093915 0%, #0f5123 58%, #14532d 100%);
  color: #ffffff;
  border-radius: 24px;
  padding: 26px 22px;
  border: 2px solid var(--lh-gold);
  box-shadow: var(--lh-shadow);
  margin-bottom: 26px;
}

.lh-hero-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 22px;
  align-items: center;
}

@media (max-width: 960px) {
  .lh-hero-grid {
    grid-template-columns: 1fr;
  }
}

.lh-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.lh-kicker {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 800;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(245, 184, 46, 0.2);
  color: #fde68a;
  border: 1px solid rgba(253, 230, 138, 0.45);
}

.lh-kicker-emerald {
  background: rgba(34, 197, 94, 0.22);
  color: #bbf7d0;
  border-color: rgba(134, 239, 172, 0.45);
}

.lh-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(22px, 3.1vw, 34px);
  line-height: 1.24;
  font-weight: 900;
}

.lh-hero-desc {
  margin: 0 0 18px;
  font-size: 14.5px;
  color: #dcfce7;
}

.lh-hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.lh-stats-panel {
  background: rgba(9, 25, 15, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 18px;
  padding: 16px;
}

.lh-stats-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 800;
  color: #fde68a;
  margin-bottom: 12px;
}

.lh-pkg-tag {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
}

.lh-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.lh-kpi-box {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 10px 12px;
}

.lh-kpi-box strong {
  display: block;
  font-size: 21px;
  font-weight: 900;
  color: #ffffff;
  line-height: 1.2;
}

.lh-kpi-box span {
  font-size: 11.5px;
  color: #bbf7d0;
}

.lh-sync-mini {
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  padding-top: 10px;
}

.lh-sync-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #ecfdf5;
  margin-bottom: 6px;
}

.lh-sync-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lh-sync-row .lh-input {
  flex: 1 1 170px;
  background: rgba(255, 255, 255, 0.95);
  color: #093915;
  font-weight: 700;
}

.lh-sync-feedback {
  margin-top: 6px;
  font-size: 11.5px;
  color: #dcfce7;
}

/* SECTION HEAD & LANGUAGE RAIL */
.lh-section {
  margin-bottom: 28px;
}

.lh-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.lh-section-title {
  margin: 0 0 4px;
  font-size: clamp(19px, 2.4vw, 24px);
  color: var(--lh-forest);
  font-weight: 900;
}

.lh-section-sub {
  margin: 0;
  font-size: 13.5px;
  color: var(--lh-muted);
}

.lh-learner-chip {
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--lh-gold-bg);
  border: 1px solid #f59e0b;
  color: #92400e;
  font-size: 12.5px;
  font-weight: 800;
}

[data-theme="dark"] .lh-learner-chip {
  color: #fde68a;
}

.lh-lang-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.lh-rail-btn {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--lh-border);
  background: var(--lh-surface);
  color: var(--lh-text);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lh-rail-btn.is-active {
  background: #093915;
  color: #ffffff;
  border-color: #093915;
}

[data-theme="dark"] .lh-rail-btn.is-active {
  background: #16a34a;
  color: #ffffff;
  border-color: #22c55e;
}

/* 10-LANGUAGE LAUNCHER GRID */
.lh-launcher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.lh-app-card {
  background: var(--lh-surface);
  border: 1.5px solid var(--lh-border);
  border-radius: 18px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--lh-shadow);
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.lh-app-card:hover {
  transform: translateY(-2px);
  border-color: var(--lh-emerald);
}

.lh-app-card.is-selected {
  border: 2.5px solid var(--lh-emerald);
  background: var(--lh-surface-alt);
}

.lh-app-top {
  display: flex;
  align-items: center;
  gap: 11px;
}

.lh-app-mascot {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  object-fit: cover;
  border: 1.5px solid var(--lh-border);
  background: #ffffff;
  flex-shrink: 0;
}

.lh-app-name {
  font-size: 15.5px;
  font-weight: 900;
  color: var(--lh-forest);
  line-height: 1.25;
}

.lh-app-exam {
  font-size: 12px;
  font-weight: 700;
  color: var(--lh-crimson);
  margin-top: 2px;
}

.lh-app-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11.5px;
  color: var(--lh-muted);
}

.lh-stat-chip {
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--lh-surface-alt);
  border: 1px solid var(--lh-border);
  font-weight: 700;
}

.lh-app-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.lh-app-actions .lh-btn {
  flex: 1 1 auto;
}

/* UNIFIED WORKSPACE */
.lh-workspace {
  background: var(--lh-surface);
  border: 2px solid var(--lh-emerald);
  border-radius: 24px;
  padding: 22px 18px;
  box-shadow: var(--lh-shadow);
  margin-bottom: 28px;
  scroll-margin-top: 78px;
}

.lh-ws-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--lh-border);
  margin-bottom: 16px;
}

.lh-ws-identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.lh-ws-mascot {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  object-fit: cover;
  border: 2px solid var(--lh-gold);
  background: #ffffff;
}

.lh-ws-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.lh-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
}

.lh-pill-green {
  background: #dcfce7;
  color: #14532d;
}

.lh-pill-gold {
  background: #fef3c7;
  color: #92400e;
}

.lh-pill-red {
  background: #fee2e2;
  color: #991b1b;
}

.lh-ws-title {
  margin: 0;
  font-size: clamp(18px, 2.4vw, 23px);
  color: var(--lh-forest);
  font-weight: 900;
}

.lh-ws-subtitle {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--lh-muted);
}

.lh-ws-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lh-ws-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.lh-ws-tab {
  min-height: 42px;
  padding: 8px 15px;
  border-radius: 999px;
  border: 1.5px solid var(--lh-border);
  background: var(--lh-surface-alt);
  color: var(--lh-text);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lh-ws-tab.is-active {
  background: #11692b;
  color: #ffffff;
  border-color: #11692b;
}

.lh-tab-count {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.14);
  font-size: 11.5px;
}

.lh-ws-tab.is-active .lh-tab-count {
  background: rgba(255, 255, 255, 0.24);
}

.lh-filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

/* LESSONS LIST */
.lh-lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}

.lh-lesson-card {
  border: 1.5px solid var(--lh-border);
  border-radius: 16px;
  padding: 15px;
  background: var(--lh-surface-alt);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.lh-lesson-card h3 {
  margin: 6px 0 4px;
  font-size: 15.5px;
  color: var(--lh-forest);
}

.lh-lesson-card p {
  margin: 0;
  font-size: 13px;
  color: var(--lh-muted);
}

.lh-lesson-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* VOCAB FLIP CARDS */
.lh-vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 14px;
}

.lh-vocab-card {
  border: 2px solid var(--lh-border);
  border-radius: 16px;
  padding: 16px;
  background: var(--lh-surface-alt);
  min-height: 175px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.lh-vocab-card:hover {
  border-color: var(--lh-emerald);
  transform: translateY(-2px);
}

.lh-vocab-card.is-mastered {
  border-color: #16a34a;
  background: rgba(22, 163, 74, 0.08);
}

.lh-vocab-word {
  font-size: 22px;
  font-weight: 900;
  color: var(--lh-forest);
  margin: 6px 0 2px;
}

.lh-vocab-reading {
  font-size: 13px;
  color: var(--lh-muted);
  font-weight: 600;
}

.lh-vocab-meaning {
  font-size: 16px;
  font-weight: 800;
  color: var(--lh-emerald);
  margin: 6px 0;
}

.lh-vocab-example {
  font-size: 12.5px;
  color: var(--lh-text);
  border-left: 3px solid var(--lh-gold);
  padding-left: 8px;
  margin-top: 6px;
}

.lh-vocab-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

/* QUIZ & EXAM ENGINE */
.lh-exam-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.lh-quiz-card {
  border: 1.5px solid var(--lh-border);
  border-radius: 16px;
  padding: 16px;
  background: var(--lh-surface-alt);
  margin-bottom: 14px;
}

.lh-quiz-prompt {
  font-size: 15.5px;
  font-weight: 800;
  color: var(--lh-text);
  margin: 6px 0;
}

.lh-quiz-aid {
  font-size: 12.5px;
  color: var(--lh-muted);
  margin-bottom: 10px;
}

.lh-quiz-options {
  display: grid;
  gap: 8px;
}

.lh-quiz-opt {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--lh-border);
  background: var(--lh-surface);
  color: var(--lh-text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.lh-quiz-opt.is-selected {
  border-color: var(--lh-emerald);
  background: #dcfce7;
  color: #093915;
  font-weight: 800;
}

.lh-quiz-opt.is-correct {
  border-color: #16a34a;
  background: #bbf7d0;
  color: #052e16;
  font-weight: 800;
}

.lh-quiz-opt.is-wrong {
  border-color: #dc2626;
  background: #fee2e2;
  color: #7f1d1d;
}

.lh-quiz-explain {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--lh-surface);
  border-left: 4px solid var(--lh-emerald);
  font-size: 13px;
}

.lh-score-banner {
  padding: 14px 16px;
  border-radius: 14px;
  background: #ecfdf5;
  border: 2px solid #16a34a;
  color: #052e16;
  font-weight: 700;
  margin-bottom: 14px;
}

/* PROMPTS & ARCHITECTURE */
.lh-prompt-card {
  border: 1.5px solid var(--lh-border);
  border-radius: 16px;
  padding: 16px;
  background: var(--lh-surface-alt);
  margin-bottom: 12px;
}

.lh-sample-box {
  margin-top: 10px;
  padding: 12px;
  border-radius: 12px;
  background: var(--lh-surface);
  border: 1px dashed var(--lh-emerald);
  font-size: 13.5px;
}

.lh-arch-card {
  background: var(--lh-surface);
  border: 1.5px solid var(--lh-border);
  border-radius: 22px;
  padding: 22px 18px;
  box-shadow: var(--lh-shadow);
}

.lh-arch-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  align-items: center;
}

@media (max-width: 900px) {
  .lh-arch-grid {
    grid-template-columns: 1fr;
  }
}

.lh-arch-card h3 {
  margin: 8px 0;
  font-size: 19px;
  color: var(--lh-forest);
}

.lh-arch-card p {
  margin: 0;
  font-size: 13.5px;
  color: var(--lh-muted);
}

.lh-arch-pills {
  display: grid;
  gap: 10px;
}

.lh-arch-item {
  padding: 11px 14px;
  border-radius: 14px;
  background: var(--lh-surface-alt);
  border: 1px solid var(--lh-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12.5px;
}

/* MODAL */
.lh-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(9, 25, 15, 0.68);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lh-modal-card {
  background: var(--lh-surface);
  color: var(--lh-text);
  border-radius: 20px;
  border: 2px solid var(--lh-emerald);
  max-width: 760px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.lh-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--lh-border);
  margin-bottom: 14px;
}

.lh-modal-title {
  margin: 6px 0 0;
  font-size: 19px;
  color: var(--lh-forest);
}

.lh-turn-row {
  padding: 11px 14px;
  border-radius: 12px;
  background: var(--lh-surface-alt);
  border-left: 4px solid var(--lh-emerald);
  margin-bottom: 10px;
}

.lh-turn-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: var(--lh-forest);
}

.lh-turn-vi {
  font-size: 13px;
  color: var(--lh-muted);
  margin-top: 4px;
}

.lh-md-block {
  white-space: pre-wrap;
  background: var(--lh-surface-alt);
  padding: 14px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.65;
  margin-bottom: 14px;
}

.lh-empty {
  padding: 24px;
  text-align: center;
  border-radius: 14px;
  background: var(--lh-surface-alt);
  color: var(--lh-muted);
  font-size: 13.5px;
}

/* TOAST & FOOTER */
.lh-toast {
  position: fixed;
  right: 16px;
  bottom: 18px;
  z-index: 90;
  background: #093915;
  color: #ffffff;
  border: 1.5px solid var(--lh-gold);
  padding: 11px 16px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25);
}

.lh-footer {
  background: #093915;
  color: #ecfdf5;
  border-top: 3px solid var(--lh-gold);
  padding: 22px 16px;
  font-size: 13px;
}

.lh-footer-inner {
  max-width: 1220px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.lh-footer a {
  color: #fde68a;
  font-weight: 700;
  text-decoration: none;
}

.lh-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
