/**
 * FastType Modern Product Wave — enterprise SaaS shell
 * v=20260801ftprod1 · mobile-first · RTL/LTR · soft entity colors
 * Layers over fasttype.css without desktop-bitmap styling.
 */
:root {
  --ftp-typing: #2563eb;
  --ftp-typing-bg: #eff6ff;
  --ftp-typing-bd: #bfdbfe;
  --ftp-learn: #059669;
  --ftp-learn-bg: #ecfdf5;
  --ftp-learn-bd: #a7f3d0;
  --ftp-achieve: #7c3aed;
  --ftp-achieve-bg: #f5f3ff;
  --ftp-achieve-bd: #ddd6fe;
  --ftp-ai: #0891b2;
  --ftp-ai-bg: #ecfeff;
  --ftp-ai-bd: #a5f3fc;
  --ftp-ok: #059669;
  --ftp-bad: #dc2626;
  --ftp-text: #0f172a;
  --ftp-muted: #64748b;
  --ftp-border: #e2e8f0;
  --ftp-card: #ffffff;
  --ftp-radius: 14px;
  --ftp-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 10px 28px rgba(15, 23, 42, 0.05);
  --ftp-touch: 44px;
}

/* Skip link — never use left:-9999px (inflates document scrollWidth) */
body.ftp-product .ft-skip,
body.ftp-product a.ft-skip {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  left: 0 !important;
  top: 0 !important;
  transform: none !important;
}
body.ftp-product .ft-skip:focus {
  width: auto !important;
  height: auto !important;
  margin: 8px !important;
  padding: 10px 14px !important;
  clip: auto !important;
  z-index: 1000;
  background: #fff !important;
  color: #0f172a !important;
  border-radius: 10px !important;
  box-shadow: var(--ftp-shadow) !important;
}

/* Force light SaaS product surface (keep dark as optional via data-theme) */
html[data-theme="light"] body.ft-body,
body.ft-body.ftp-product {
  background: #f8fafc !important;
  color: var(--ftp-text);
}
body.ftp-product .ft-top,
body.ftp-product .fx-top {
  background: rgba(255, 255, 255, 0.92) !important;
  border-bottom: 1px solid var(--ftp-border) !important;
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 40;
}
body.ftp-product .ft-card,
body.ftp-product .fx-card {
  background: var(--ftp-card) !important;
  border: 1px solid var(--ftp-border) !important;
  border-radius: var(--ftp-radius) !important;
  box-shadow: var(--ftp-shadow) !important;
  color: var(--ftp-text) !important;
}

/* Viewport safety — hard containment (keyboard layouts can be huge) */
html:has(body.ftp-product),
body.ftp-product {
  max-width: 100vw !important;
  overflow-x: hidden !important;
}
body.ftp-product,
body.ftp-product .ft-main,
body.ftp-product .ft-center,
body.ftp-product .ft-side,
body.ftp-product .ft-top,
body.ftp-product .ft-prompt-card,
body.ftp-product .ft-keyboard-wrap,
body.ftp-product #ft-practice-panel,
body.ftp-product #ft-home-panel,
body.ftp-product #ft-path-panel {
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}
body.ftp-product img,
body.ftp-product svg,
body.ftp-product canvas {
  max-width: 100%;
  height: auto;
}
body.ftp-product * {
  box-sizing: border-box;
}

/* Product brand */
.ftp-brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: contain;
  background: var(--ftp-typing-bg);
  border: 1px solid var(--ftp-typing-bd);
  padding: 4px;
  flex-shrink: 0;
}
.ftp-brand-icon.lg {
  width: 56px;
  height: 56px;
  border-radius: 16px;
}

/* Product primary nav */
.ftp-pnav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid var(--ftp-border);
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.ftp-pnav a,
.ftp-pnav button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--ftp-touch);
  min-width: var(--ftp-touch);
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--ftp-border);
  background: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  color: #334155;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.ftp-pnav a.is-active,
.ftp-pnav button.is-active,
.ftp-pnav a:hover,
.ftp-pnav button:hover {
  background: var(--ftp-typing-bg);
  border-color: var(--ftp-typing-bd);
  color: var(--ftp-typing);
}

/* Identity strip */
.ftp-identity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin: 0 0 12px;
  border-radius: var(--ftp-radius);
  background: linear-gradient(180deg, #fff, var(--ftp-typing-bg));
  border: 1px solid var(--ftp-typing-bd);
  min-width: 0;
  box-shadow: var(--ftp-shadow);
}
.ftp-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #2563eb);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
}
.ftp-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ftp-identity .name {
  font-size: 14px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ftp-identity .meta {
  font-size: 11px;
  color: var(--ftp-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.ftp-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
}
.ftp-badge.typing { background: var(--ftp-typing-bg); color: var(--ftp-typing); }
.ftp-badge.learn { background: var(--ftp-learn-bg); color: var(--ftp-learn); }
.ftp-badge.achieve { background: var(--ftp-achieve-bg); color: var(--ftp-achieve); }
.ftp-badge.ai { background: var(--ftp-ai-bg); color: var(--ftp-ai); }

/* Dashboard KPI grid */
.ftp-kpi-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  min-width: 0;
  margin-bottom: 14px;
}
@media (min-width: 480px) {
  .ftp-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .ftp-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
  .ftp-kpi-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
.ftp-kpi {
  background: var(--ftp-card);
  border: 1px solid var(--ftp-border);
  border-radius: var(--ftp-radius);
  padding: 14px;
  min-width: 0;
  box-shadow: var(--ftp-shadow);
  width: 100%;
}
.ftp-kpi.tone-typing { background: linear-gradient(180deg, #fff, var(--ftp-typing-bg)); border-color: var(--ftp-typing-bd); }
.ftp-kpi.tone-learn { background: linear-gradient(180deg, #fff, var(--ftp-learn-bg)); border-color: var(--ftp-learn-bd); }
.ftp-kpi.tone-achieve { background: linear-gradient(180deg, #fff, var(--ftp-achieve-bg)); border-color: var(--ftp-achieve-bd); }
.ftp-kpi .ico { font-size: 18px; line-height: 1; }
.ftp-kpi .val {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ftp-kpi .lbl { font-size: 11px; font-weight: 700; color: var(--ftp-muted); margin-top: 2px; }
.ftp-kpi.is-empty .val { color: #94a3b8; font-size: 1.1rem; }

/* Progress ring */
.ftp-ring-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: center;
  min-width: 0;
}
.ftp-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background: conic-gradient(var(--ftp-typing) calc(var(--p, 0) * 1%), #e2e8f0 0);
  flex-shrink: 0;
}
.ftp-ring::after {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: #fff;
}
.ftp-ring span {
  position: relative;
  z-index: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
}
.ftp-ring span small {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--ftp-muted);
}

/* Lesson path cards */
.ftp-lesson-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  min-width: 0;
}
@media (min-width: 640px) {
  .ftp-lesson-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .ftp-lesson-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.ftp-lesson-card {
  background: #fff;
  border: 1px solid var(--ftp-border);
  border-radius: var(--ftp-radius);
  padding: 14px;
  min-width: 0;
  box-shadow: var(--ftp-shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.ftp-lesson-card .head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.ftp-lesson-card .lico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: var(--ftp-learn-bg);
  border: 1px solid var(--ftp-learn-bd);
  flex-shrink: 0;
}
.ftp-lesson-card .title {
  font-size: 13px;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ftp-lesson-card .bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.ftp-lesson-card .bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--ftp-learn), #34d399);
  border-radius: 999px;
  min-width: 0;
}
.ftp-lesson-card .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}
.ftp-lesson-card .actions .btn,
.ftp-btn {
  min-height: var(--ftp-touch);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--ftp-border);
  background: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  color: var(--ftp-text);
}
.ftp-btn-primary {
  background: var(--ftp-typing) !important;
  border-color: var(--ftp-typing) !important;
  color: #fff !important;
}
.ftp-btn-learn {
  background: var(--ftp-learn) !important;
  border-color: var(--ftp-learn) !important;
  color: #fff !important;
}

/* Character states polish */
body.ftp-product .ft-ch.ok {
  color: #047857 !important;
  background: rgba(16, 185, 129, 0.12);
  border-radius: 3px;
}
body.ftp-product .ft-ch.bad {
  color: #b91c1c !important;
  background: rgba(239, 68, 68, 0.14);
  border-radius: 3px;
}
body.ftp-product .ft-ch.cur {
  background: rgba(37, 99, 235, 0.18) !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
  border-radius: 3px;
}

/* Practice chrome */
body.ftp-product .ft-metrics {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}
@media (min-width: 640px) {
  body.ftp-product .ft-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  body.ftp-product .ft-metrics {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}
body.ftp-product .ft-prompt-card,
body.ftp-product .ft-prompt {
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}
body.ftp-product .ft-input {
  min-height: 120px;
  font-size: 18px !important;
  line-height: 1.7 !important;
  border: 2px solid var(--ftp-typing-bd) !important;
  border-radius: 12px !important;
  background: #fff !important;
  color: var(--ftp-text) !important;
  max-width: 100%;
}
body.ftp-product .ft-run-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
body.ftp-product .ft-run-actions .mft-btn,
body.ftp-product .ft-run-actions button {
  min-height: var(--ftp-touch);
  min-width: 44px;
}

/* Keyboard responsive — never expand page width */
body.ftp-product .ft-keyboard-wrap {
  overflow-x: auto !important;
  max-width: 100% !important;
  width: 100% !important;
  -webkit-overflow-scrolling: touch;
}
body.ftp-product .ft-keyboard,
body.ftp-product #ft-keyboard,
body.ftp-product .ft-kb,
body.ftp-product [class*="keyboard"] {
  max-width: 100% !important;
  width: 100% !important;
  min-width: 0 !important;
  transform-origin: top center;
}
body.ftp-product .ft-kb-row,
body.ftp-product .ft-keyboard .row {
  display: flex !important;
  flex-wrap: nowrap !important;
  justify-content: center;
  gap: 2px;
  max-width: 100%;
  min-width: 0;
}
body.ftp-product .ft-key {
  min-height: 36px;
  min-width: 0 !important;
  flex: 1 1 0;
  max-width: 48px;
  border-radius: 8px !important;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 768px) {
  body.ftp-product .ft-keyboard,
  body.ftp-product #ft-keyboard {
    font-size: 10px;
  }
  body.ftp-product .ft-key {
    min-height: 30px;
    max-width: 36px;
    font-size: 9px;
    padding: 1px !important;
  }
  body.ftp-product .ft-hand-guide {
    display: none !important;
  }
}
@media (max-width: 480px) {
  body.ftp-product .ft-key {
    min-height: 28px;
    max-width: 28px;
    font-size: 8px;
  }
}

/* Exam settings */
.ftp-exam-setup {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  min-width: 0;
}
@media (min-width: 720px) {
  .ftp-exam-setup { grid-template-columns: 1fr 1fr; }
}
.ftp-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ftp-chip {
  min-height: var(--ftp-touch);
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--ftp-border);
  background: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}
.ftp-chip.is-active {
  background: var(--ftp-typing-bg);
  border-color: var(--ftp-typing-bd);
  color: var(--ftp-typing);
}

/* Certificate card */
.ftp-cert-card {
  max-width: 520px;
  margin: 0 auto;
  background: linear-gradient(180deg, #fffef8, #fff);
  border: 2px solid #e7e5e4;
  border-radius: 18px;
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--ftp-shadow);
  min-width: 0;
}
.ftp-cert-card .seal {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--ftp-achieve-bg);
  border: 2px solid var(--ftp-achieve-bd);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.ftp-cert-card .seal img {
  width: 70%;
  height: 70%;
  object-fit: contain;
}
.ftp-cert-card h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  font-weight: 900;
}
.ftp-cert-card .score {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--ftp-typing);
  margin: 12px 0;
}

/* Achievement badges */
.ftp-badge-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}
@media (min-width: 640px) {
  .ftp-badge-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.ftp-ach {
  background: #fff;
  border: 1px solid var(--ftp-border);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  min-width: 0;
  box-shadow: var(--ftp-shadow);
}
.ftp-ach.locked { opacity: 0.55; filter: grayscale(0.4); }
.ftp-ach .ai { font-size: 22px; }
.ftp-ach .at { font-size: 11px; font-weight: 850; margin-top: 4px; }
.ftp-ach .ad { font-size: 10px; color: var(--ftp-muted); }

/* Leaderboard */
.ftp-lb {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.ftp-lb-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--ftp-border);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 0;
  box-shadow: var(--ftp-shadow);
}
.ftp-lb-row .rank {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--ftp-achieve-bg);
  color: var(--ftp-achieve);
  font-weight: 900;
  font-size: 12px;
  display: grid;
  place-items: center;
}
.ftp-lb-row .nm {
  font-weight: 850;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ftp-lb-row .sc {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--ftp-typing);
}

/* Timeline */
.ftp-tl {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-inline-start: 2px solid #e2e8f0;
  padding-inline-start: 12px;
  margin: 8px 0;
}
.ftp-tl li {
  list-style: none;
  position: relative;
  padding: 8px 0;
  font-size: 12px;
  color: var(--ftp-muted);
}
.ftp-tl li::before {
  content: '';
  position: absolute;
  inset-inline-start: -17px;
  top: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ftp-typing);
}

/* AI rail */
.ftp-ai-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
  min-width: 0;
}
.ftp-ai-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--ftp-touch);
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--ftp-ai-bd);
  background: linear-gradient(180deg, #fff, var(--ftp-ai-bg));
  font-size: 12px;
  font-weight: 750;
  color: #0e7490;
  cursor: pointer;
  max-width: 100%;
}
.ftp-ai-chip .dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #06b6d4, #2563eb);
  flex-shrink: 0;
}

/* Empty */
.ftp-empty {
  text-align: center;
  padding: 28px 16px;
  border: 1px dashed var(--ftp-border);
  border-radius: var(--ftp-radius);
  background: #fff;
  min-width: 0;
}
.ftp-empty .ico { font-size: 28px; margin-bottom: 8px; }
.ftp-empty strong { display: block; font-size: 14px; }
.ftp-empty p {
  margin: 6px auto 0;
  font-size: 12px;
  color: var(--ftp-muted);
  max-width: 36ch;
  line-height: 1.5;
}

/* Section title */
.ftp-sec {
  margin: 16px 0;
  min-width: 0;
}
.ftp-sec-h {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.ftp-sec-h h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 900;
  color: var(--ftp-text);
}

/* Landing product redesign */
body.ftp-product .fx-hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
  min-width: 0;
}
body.ftp-product .fx-btn {
  min-height: var(--ftp-touch);
  border-radius: 12px !important;
}
body.ftp-product .ft-hub-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px !important;
  min-width: 0;
}
@media (min-width: 640px) {
  body.ftp-product .ft-hub-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}
@media (min-width: 900px) {
  body.ftp-product .ft-hub-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}
body.ftp-product .ft-hub-card {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 72px;
  border-radius: 14px !important;
  border: 1px solid var(--ftp-border) !important;
  background: #fff !important;
  box-shadow: var(--ftp-shadow) !important;
  display: flex !important;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 12px !important;
  text-decoration: none;
  color: var(--ftp-text);
}

/* Workspace layout: never force desktop min widths */
body.ftp-product .ft-main {
  display: flex !important;
  flex-wrap: wrap !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  gap: 12px;
  padding: 12px !important;
}
body.ftp-product .ft-side {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  flex: 1 1 260px;
}
body.ftp-product .ft-center {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  flex: 1 1 320px;
}
body.ftp-product .ft-top {
  flex-wrap: wrap !important;
  max-width: 100% !important;
  min-width: 0 !important;
}
body.ftp-product .ft-brand {
  min-width: 0 !important;
}
body.ftp-product .ft-top-actions {
  flex-wrap: wrap !important;
  gap: 6px;
  max-width: 100%;
}
@media (max-width: 900px) {
  body.ftp-product .ft-main {
    flex-direction: column !important;
  }
  body.ftp-product .ft-side {
    order: 2;
  }
  body.ftp-product .ft-center {
    order: 1;
  }
  body.ftp-product .ft-nav {
    display: none !important; /* product nav replaces dense top nav on mobile */
  }
}
/* Kill any layout engine absolute widths */
body.ftp-product .ft-key.wide {
  min-width: 0 !important;
  flex: 2 1 0 !important;
  max-width: 72px !important;
}

/* Fullscreen exam polish */
body.ftp-exam-mode .fx-exam-chrome {
  max-width: 900px;
  margin: 0 auto;
  padding: 12px;
  min-width: 0;
}
body.ftp-exam-mode .fx-exam-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
@media (min-width: 640px) {
  body.ftp-exam-mode .fx-exam-bar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Admin FastType analytics cards */
.ftp-admin-root {
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
  padding: 4px 0 20px;
}

/* Hide noisy extra metrics on very small screens */
@media (max-width: 390px) {
  body.ftp-product .ft-metric-mini.extra {
    display: none;
  }
}

/* =========================================================
   FastType Complete Product Wave — v=20260801ftcomplete1
   ========================================================= */
body.ftp-complete.ftp-product,
body.ftp-product.ftp-complete {
  --ftp-journey-gap: 12px;
}

/* Journey grid */
.ftp-journey {
  margin: 16px 0 24px;
  min-width: 0;
  max-width: 100%;
}
.ftp-journey-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--ftp-text);
}
.ftp-journey-flow {
  font-size: 12px;
  font-weight: 700;
  color: var(--ftp-muted);
  margin: 0 0 14px;
  padding: 10px 12px;
  background: #fff;
  border: 1px dashed var(--ftp-border);
  border-radius: 12px;
  overflow-wrap: anywhere;
  line-height: 1.5;
}
.ftp-journey-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--ftp-journey-gap);
  min-width: 0;
}
@media (min-width: 560px) {
  .ftp-journey-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 960px) {
  .ftp-journey-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
  .ftp-journey-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
.ftp-journey-card {
  background: #fff;
  border: 1px solid var(--ftp-border);
  border-radius: var(--ftp-radius);
  padding: 16px;
  min-width: 0;
  box-shadow: var(--ftp-shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.ftp-journey-card.tone-learn { background: linear-gradient(180deg, #fff, var(--ftp-learn-bg)); border-color: var(--ftp-learn-bd); }
.ftp-journey-card.tone-typing { background: linear-gradient(180deg, #fff, var(--ftp-typing-bg)); border-color: var(--ftp-typing-bd); }
.ftp-journey-card.tone-achieve { background: linear-gradient(180deg, #fff, var(--ftp-achieve-bg)); border-color: var(--ftp-achieve-bd); }
.ftp-journey-card .j-ico {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: #fff;
  border: 1px solid var(--ftp-border);
}
.ftp-journey-card .j-title {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
}
.ftp-journey-card .j-desc {
  margin: 0;
  font-size: 12px;
  color: var(--ftp-muted);
  line-height: 1.45;
  flex: 1;
}
.ftp-journey-card .j-progress { min-width: 0; }
.ftp-journey-card .j-pct {
  display: block;
  font-size: 11px;
  font-weight: 750;
  color: var(--ftp-muted);
  margin-top: 4px;
}
.ftp-journey-card .j-pct.empty { color: #94a3b8; font-weight: 600; }
.ftp-journey-card .ftp-btn {
  width: 100%;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ftp-progress-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.ftp-progress-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--ftp-typing), #60a5fa);
  border-radius: 999px;
  min-width: 0;
}

/* Premium practice metrics */
.ftp-metrics-premium {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
  min-width: 0;
}
@media (min-width: 640px) {
  .ftp-metrics-premium { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.ftp-m-card {
  background: #fff;
  border: 1px solid var(--ftp-border);
  border-radius: 12px;
  padding: 12px;
  min-width: 0;
  box-shadow: var(--ftp-shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ftp-m-card.tone-typing { background: linear-gradient(180deg, #fff, var(--ftp-typing-bg)); border-color: var(--ftp-typing-bd); }
.ftp-m-card.tone-learn { background: linear-gradient(180deg, #fff, var(--ftp-learn-bg)); border-color: var(--ftp-learn-bd); }
.ftp-m-card.tone-achieve { background: linear-gradient(180deg, #fff, var(--ftp-achieve-bg)); border-color: var(--ftp-achieve-bd); }
.ftp-m-card .m-lbl { font-size: 10px; font-weight: 800; color: var(--ftp-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.ftp-m-card .m-val { font-size: 1.35rem; font-weight: 900; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ftp-m-card .m-unit { font-size: 10px; font-weight: 700; color: var(--ftp-muted); }

/* Lesson indicator */
.ftp-lesson-indicator {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: linear-gradient(180deg, #fff, var(--ftp-learn-bg));
  border: 1px solid var(--ftp-learn-bd);
  border-radius: 12px;
  min-width: 0;
  box-shadow: var(--ftp-shadow);
}
.ftp-lesson-indicator .li-ico { font-size: 20px; flex-shrink: 0; }
.ftp-lesson-indicator .li-lbl { font-size: 10px; font-weight: 800; color: var(--ftp-muted); }
.ftp-lesson-indicator .li-title {
  font-size: 13px;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Lesson meta + states */
.ftp-lesson-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.ftp-lesson-card.state-locked { opacity: 0.72; }
.ftp-lesson-card.state-completed { border-color: var(--ftp-learn-bd); }
.ftp-lesson-card.state-available { border-color: var(--ftp-typing-bd); }

/* Mistake summary */
.ftp-mistake-summary {
  margin-top: 12px;
  min-width: 0;
}
.ftp-mistake-summary.hidden { display: none !important; }
.ftp-weak-keys { margin-top: 10px; }
.ftp-weak-keys strong { font-size: 12px; display: block; margin-bottom: 6px; }
.ftp-key-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.ftp-key-chip {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  font-size: 12px;
  font-weight: 750;
  color: #991b1b;
}

/* AI panel label */
.ftp-ai-panel-label {
  width: 100%;
  font-size: 11px;
  font-weight: 800;
  color: var(--ftp-ai);
  margin-bottom: 2px;
}

/* Progress dashboard */
.ftp-progress-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  min-width: 0;
}
@media (min-width: 720px) {
  .ftp-progress-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.ftp-prog-card {
  background: #fff;
  border: 1px solid var(--ftp-border);
  border-radius: var(--ftp-radius);
  padding: 14px;
  min-width: 0;
  box-shadow: var(--ftp-shadow);
}
.ftp-prog-card .pc-h {
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 10px;
  color: var(--ftp-text);
}
.ftp-prog-card .pc-val {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.ftp-prog-card .pc-hint {
  font-size: 11px;
  color: var(--ftp-muted);
  margin: 4px 0 0;
}

/* Mini chart (CSS only, no libs) */
.ftp-mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-height: 96px;
  padding: 12px 8px 4px;
  background: #fff;
  border: 1px solid var(--ftp-border);
  border-radius: 12px;
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
.ftp-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1 1 12px;
  min-width: 14px;
  max-width: 28px;
}
.ftp-bar-col i {
  display: block;
  width: 100%;
  min-height: 4px;
  background: linear-gradient(180deg, var(--ftp-typing), #93c5fd);
  border-radius: 4px 4px 2px 2px;
}
.ftp-bar-col span {
  font-size: 8px;
  color: var(--ftp-muted);
  font-weight: 700;
  white-space: nowrap;
}

/* Exam result card */
.ftp-result-card {
  margin: 12px 0;
  padding: 14px;
  background: linear-gradient(180deg, #fff, var(--ftp-typing-bg));
  border: 1px solid var(--ftp-typing-bd);
  border-radius: var(--ftp-radius);
  min-width: 0;
  text-align: start;
  box-shadow: var(--ftp-shadow);
}
.ftp-cert-elig {
  margin-top: 12px;
  padding: 12px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--ftp-border);
}
.ftp-cert-elig strong { display: block; font-size: 13px; margin-bottom: 4px; }
.ftp-cert-elig p { margin: 0 0 10px; font-size: 12px; color: var(--ftp-muted); line-height: 1.45; }

/* Certificate identity */
.ftp-cert-identity {
  margin: 12px 0;
  padding: 12px;
  background: linear-gradient(180deg, #fff, var(--ftp-achieve-bg));
  border: 1px solid var(--ftp-achieve-bd);
  border-radius: 12px;
  min-width: 0;
}
.ftp-cert-identity .ci-lbl { font-size: 10px; font-weight: 800; color: var(--ftp-muted); text-transform: uppercase; }
.ftp-cert-identity .ci-name { font-size: 1.1rem; font-weight: 900; margin: 4px 0; overflow-wrap: anywhere; }
.ftp-cert-identity .ci-meta { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

/* Leaderboard cards */
.ftp-lb-row.ftp-lb-card {
  grid-template-columns: 32px 36px minmax(0, 1fr) auto auto;
  gap: 8px;
}
.ftp-lb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #2563eb);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 14px;
  flex-shrink: 0;
}
.ftp-lb-ach { justify-self: end; }

/* Landing journey host */
.ftp-landing-journey {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 16px 24px;
  min-width: 0;
}

/* Mobile quality hard rules */
@media (max-width: 480px) {
  body.ftp-product .ftp-metrics-premium { gap: 6px; }
  body.ftp-product .ftp-m-card .m-val { font-size: 1.15rem; }
  body.ftp-product .ftp-journey-card { padding: 12px; }
  body.ftp-product .ft-side { max-width: 100% !important; }
  body.ftp-product .ft-main {
    flex-direction: column !important;
  }
}
@media (max-width: 390px) {
  body.ftp-product .ftp-pnav a { padding: 8px 10px; font-size: 11px; }
}
/* Zero horizontal overflow — complete wave */
body.ftp-complete,
body.ftp-complete * {
  max-width: 100vw;
}
body.ftp-complete .ftp-journey-grid,
body.ftp-complete .ftp-progress-cards,
body.ftp-complete .ftp-metrics-premium,
body.ftp-complete .ftp-lesson-grid,
body.ftp-complete .ftp-result-card {
  max-width: 100%;
  min-width: 0;
}

/* AI Coach card — student dashboard (ftai1) */
.ftp-ai-coach {
  background: linear-gradient(180deg, #fff, #ecfeff);
  border: 1px solid #a5f3fc;
  border-radius: 14px;
  padding: 14px;
  margin: 12px 0;
  min-width: 0;
  max-width: 100%;
  box-shadow: var(--ftp-shadow);
}
.ftp-ai-coach .coach-h {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.ftp-ai-coach .coach-h h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 900;
  color: #0891b2;
}
.ftp-ai-coach .coach-status {
  font-size: 12px;
  color: #64748b;
  margin: 0 0 10px;
  line-height: 1.45;
}
.ftp-ai-coach .coach-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ftp-ai-coach .coach-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
  min-width: 0;
}
@media (min-width: 480px) {
  .ftp-ai-coach .coach-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.ftp-ai-coach .cs {
  background: #fff;
  border-radius: 10px;
  padding: 8px;
  border: 1px solid #e2e8f0;
  min-width: 0;
}
.ftp-ai-coach .cs .v {
  font-weight: 900;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ftp-ai-coach .cs .l {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
}

/* ── Learner simplification (20260801ftsimple1) ── */
body.ftp-learner-simple .ftp-learner-hide,
body.ftp-product .ftp-learner-hide { display: none !important; }
.ftp-learner-home { margin-bottom: 1rem; }
.ftp-learner-intro { margin-bottom: 1rem; }
.ftp-kicker { font-size: 12px; font-weight: 800; color: #2563eb; letter-spacing: .02em; margin: 0 0 .35rem; }
.ftp-learner-h1 { font-size: clamp(1.35rem, 3vw, 1.85rem); margin: 0 0 .5rem; line-height: 1.3; color: #0f172a; }
.ftp-learner-sub { color: #64748b; margin: 0 0 1rem; line-height: 1.6; max-width: 40rem; }
.ftp-lang-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ftp-lang-label { font-size: 13px; font-weight: 700; color: #334155; }
.ftp-lang-chip { border: 1px solid #cbd5e1; background: #fff; border-radius: 999px; padding: 8px 14px; min-height: 40px; font: inherit; font-weight: 700; cursor: pointer; }
.ftp-lang-chip.is-active { background: #2563eb; color: #fff; border-color: #2563eb; }
.ftp-tracks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) { .ftp-tracks { grid-template-columns: 1fr; } }
.ftp-track-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 1.1rem 1.15rem 1.2rem;
  box-shadow: 0 1px 3px rgba(15,23,42,.06), 0 10px 28px rgba(15,23,42,.04);
  display: flex; flex-direction: column; gap: .55rem; min-height: 100%;
}
.ftp-track-beginner { border-top: 4px solid #059669; }
.ftp-track-intermediate { border-top: 4px solid #2563eb; }
.ftp-track-advanced { border-top: 4px solid #7c3aed; }
.ftp-track-icon { font-size: 1.75rem; line-height: 1; }
.ftp-track-title { margin: 0; font-size: 1.2rem; color: #0f172a; }
.ftp-track-desc { margin: 0; color: #64748b; font-size: 14px; line-height: 1.55; flex: 1; }
.ftp-track-points { margin: 0; padding-inline-start: 1.1rem; color: #334155; font-size: 13px; line-height: 1.55; }
.ftp-track-cta { margin-top: .35rem; width: 100%; min-height: 44px; justify-content: center; }
.ftp-skill-row { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ftp-skill-note { margin: 0; font-size: 12.5px; color: #64748b; max-width: 28rem; }
.ftp-skill-summary { margin-bottom: .85rem !important; border: 1px solid #bfdbfe !important; background: #eff6ff !important; }
.ftp-skill-band { font-size: 1.35rem; font-weight: 800; color: #1e40af; margin: .35rem 0; }
.ftp-skill-num { font-size: 1rem; font-weight: 700; color: #64748b; }
.ftp-skill-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: .5rem 0; }
.ftp-skill-metrics span { display: block; font-size: 11px; color: #64748b; font-weight: 700; }
.ftp-skill-metrics strong { font-size: 1.15rem; color: #0f172a; }
.ftp-trend { margin: .4rem 0 0; font-size: 13px; font-weight: 700; }
.ftp-trend-up { color: #059669; }
.ftp-trend-down { color: #b45309; }
.ftp-trend-flat { color: #64748b; }
.ftp-more { position: relative; }
.ftp-more-sum { list-style: none; cursor: pointer; font-weight: 700; font-size: 13px; padding: 8px 12px; border-radius: 999px; border: 1px solid #e2e8f0; background: #fff; min-height: 40px; display: inline-flex; align-items: center; }
.ftp-more-sum::-webkit-details-marker { display: none; }
.ftp-more-menu { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); min-width: 200px; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 12px 32px rgba(15,23,42,.12); padding: 8px; z-index: 50; display: flex; flex-direction: column; gap: 4px; }
.ftp-more-menu a { padding: 8px 10px; border-radius: 8px; text-decoration: none; color: #0f172a; font-size: 13px; font-weight: 600; }
.ftp-more-menu a:hover { background: #f1f5f9; }
body.ftp-learner-simple .ft-side .ft-card:has(#ft-missions),
body.ftp-learner-simple .ft-side .ft-card:has(#ft-modes) { /* optional collapse via JS hide of modes noise */ }
body.ftp-learner-simple #ft-modes { max-height: 120px; overflow: auto; }
body.ftp-learner-simple .ftp-metric-secondary { opacity: .55; font-size: 0.9em; }
.ftp-land-track { display: flex; flex-direction: column; gap: 4px; text-align: start; padding: 12px; border-radius: 12px; border: 1px solid #e2e8f0; background: #fff; text-decoration: none; color: inherit; }
.ftp-land-track strong { color: #0f172a; }
.ftp-land-track span { font-size: 12.5px; color: #64748b; line-height: 1.45; }
/* Dark theme (workspace default) */
html[data-theme="dark"] .ftp-learner-h1,
html[data-theme="dark"] .ftp-track-title { color: #f1f5f9; }
html[data-theme="dark"] .ftp-learner-sub,
html[data-theme="dark"] .ftp-track-desc,
html[data-theme="dark"] .ftp-skill-note { color: #94a3b8; }
html[data-theme="dark"] .ftp-lang-label,
html[data-theme="dark"] .ftp-track-points { color: #cbd5e1; }
html[data-theme="dark"] .ftp-track-card,
html[data-theme="dark"] .ftp-land-track,
html[data-theme="dark"] .ftp-more-sum,
html[data-theme="dark"] .ftp-more-menu,
html[data-theme="dark"] .ftp-lang-chip {
  background: #0f172a; border-color: #334155; color: #e2e8f0;
}
html[data-theme="dark"] .ftp-lang-chip.is-active { background: #2563eb; border-color: #2563eb; color: #fff; }
html[data-theme="dark"] .ftp-skill-summary { background: #0b1e3a !important; border-color: #1e3a5f !important; }
html[data-theme="dark"] .ftp-skill-band { color: #93c5fd; }
html[data-theme="dark"] .ftp-skill-metrics strong { color: #f8fafc; }
html[data-theme="dark"] .ftp-more-menu a { color: #e2e8f0; }
html[data-theme="dark"] .ftp-more-menu a:hover { background: #1e293b; }
html[data-theme="dark"] .ftp-kicker { color: #60a5fa; }
@media (max-width: 720px) {
  body.ftp-learner-simple .ft-top-actions .ft-link { display: none; }
  body.ftp-learner-simple .ft-top-actions #ftp-more { display: inline-block; }
  .ftp-skill-metrics { grid-template-columns: 1fr 1fr 1fr; }
  body.ftp-learner-simple .ft-nav { flex-wrap: wrap; }
  body.ftp-learner-simple .ftp-pnav { flex-wrap: wrap; gap: 4px; font-size: 13px; }
  .ftp-track-cta, .ftp-lang-chip, .ftp-skill-test { min-height: 44px; }
}
