/* HTyping Studio + Typinge 9.31 Design System */
@font-face { font-family: "TypingeRaavi"; src: url("/font/Raavi.woff") format("woff"); font-display: swap; }
@font-face { font-family: "TypingeAsees"; src: url("/font/converter/asees.woff") format("woff"); font-display: swap; }
@font-face { font-family: "TypingeAnmol"; src: url("/font/converter/anmol.woff") format("woff"); font-display: swap; }
@font-face { font-family: "TypingeKruti"; src: url("/font/converter/krutidev.woff") format("woff"), url("/font/KRDEV160.TTF") format("truetype"); font-display: swap; }
@font-face { font-family: "TypingeGurbani"; src: url("/font/converter/gurbani.woff") format("woff"); font-display: swap; }
@font-face { font-family: "TypingeChatrik"; src: url("/font/converter/dr_chatrik.woff") format("woff"); font-display: swap; }
@font-face { font-family: "TypingeJoy"; src: url("/font/converter/joy.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "TypingeSatluj"; src: url("/font/converter/satluj.woff") format("woff"); font-display: swap; }
@font-face { font-family: "TypingeChanakya"; src: url("/font/converter/chanakya.ttf") format("truetype"); font-display: swap; }

:root,
[data-theme="typinge"] {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-elevated: #f1f5f9;
  --border: #e2e8f0;
  --ink: #334155;
  --ink-strong: #0f172a;
  --ink-muted: #64748b;
  --ink-done: #94a3b8;
  --accent: #0066ff;
  --accent-2: #764ba2;
  --accent-soft: rgba(0, 102, 255, 0.10);
  --danger: #e11d48;
  --danger-soft: rgba(225, 29, 72, 0.12);
  --ghost: #d97706;
  --caret: #0066ff;
}

[data-theme="obsidian"] {
  --bg: #0b101b;
  --surface: #121927;
  --surface-elevated: #1a2436;
  --border: #243249;
  --ink: #e2e8f0;
  --ink-strong: #ffffff;
  --ink-muted: #64748b;
  --ink-done: #475569;
  --accent: #10b981;
  --accent-2: #06b6d4;
  --accent-soft: rgba(16, 185, 129, 0.14);
  --danger: #f43f5e;
  --danger-soft: rgba(244, 63, 94, 0.16);
  --ghost: #f59e0b;
  --caret: #22d3ee;
}

[data-theme="ivory"] {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-elevated: #f8fafc;
  --border: #dbe3ee;
  --ink: #334155;
  --ink-strong: #0f172a;
  --ink-muted: #64748b;
  --ink-done: #94a3b8;
  --accent: #0d9488;
  --accent-2: #0284c7;
  --accent-soft: rgba(13, 148, 136, 0.12);
  --danger: #e11d48;
  --danger-soft: rgba(225, 29, 72, 0.12);
  --ghost: #d97706;
  --caret: #0284c7;
}

[data-theme="terminal"] {
  --bg: #050a08;
  --surface: #0a1410;
  --surface-elevated: #0f1e18;
  --border: #173328;
  --ink: #a7f3d0;
  --ink-strong: #ecfdf5;
  --ink-muted: #34d399;
  --ink-done: #065f46;
  --accent: #22c55e;
  --accent-2: #10b981;
  --accent-soft: rgba(34, 197, 94, 0.15);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.16);
  --ghost: #facc15;
  --caret: #4ade80;
}

[data-theme="heritage"] {
  --bg: #fbf6ec;
  --surface: #fffdf8;
  --surface-elevated: #f5ebd8;
  --border: #e6d7bd;
  --ink: #292524;
  --ink-strong: #0c0a09;
  --ink-muted: #78716c;
  --ink-done: #a8a29e;
  --accent: #d97706;
  --accent-2: #b45309;
  --accent-soft: rgba(217, 119, 6, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.12);
  --ghost: #0284c7;
  --caret: #d97706;
}

:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.2s ease, color 0.2s ease;
}

/* Topbar */
.ht-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  transition: opacity 0.25s ease;
}

body.focus-active .ht-topbar,
body.focus-active .ht-footer {
  opacity: 0.15;
}

.ht-topbar-inner {
  max-width: 1420px;
  margin: 0 auto;
  padding: 0.42rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.ht-subnav-wrap {
  background: var(--surface-elevated);
  border-top: 1px solid var(--border);
  padding: 0.28rem 1rem;
}

.ht-subnav-wrap .ht-nav {
  max-width: 1420px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  overflow-x: auto;
  scrollbar-width: none;
  flex-wrap: nowrap;
}
.ht-subnav-wrap .ht-nav::-webkit-scrollbar { display: none; }

.ht-pulse-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #ffffff;
  font-weight: 900;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px var(--accent-soft);
}

.ht-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--ink-strong);
}

.ht-brand-name {
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}

.ht-domain-pill {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
}

.ht-nav-item {
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3rem 0.55rem;
  border-radius: 7px;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.ht-nav-item:hover { color: var(--ink-strong); background: var(--surface-elevated); }
.ht-nav-item.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.ht-toolbar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.ht-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  color: var(--ink);
}

.ht-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.ht-select, .ht-input {
  background: var(--surface-elevated);
  color: var(--ink-strong);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.38rem 0.6rem;
  font-size: 0.84rem;
  font-family: inherit;
  outline: none;
  max-width: 100%;
  min-width: 0;
}

.ht-select:focus, .ht-input:focus {
  border-color: var(--accent);
}

/* Main Stage */
.ht-stage {
  max-width: 1080px;
  width: 100%;
  margin: 1.5rem auto 2.5rem;
  padding: 0 1.25rem;
  flex: 1;
}

.ht-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.05rem 1.15rem;
  margin-bottom: 1rem;
  box-shadow: 0 3px 14px rgba(15, 23, 42, 0.05);
  min-width: 0;
  max-width: 100%;
}

.ht-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
  min-width: 0;
}
.ht-card-head > * { min-width: 0; max-width: 100%; }

.ht-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink-strong);
}

.ht-subtitle {
  color: var(--ink-muted);
  font-size: 0.88rem;
}

/* Mode Config Strip */
.ht-pill-group {
  display: inline-flex;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.2rem;
  gap: 0.2rem;
  flex-wrap: wrap;
}

.ht-pill-btn {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 0.7rem;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ht-pill-btn:hover { color: var(--ink-strong); }
.ht-pill-btn.active {
  background: var(--accent);
  color: #ffffff;
}

/* Live Telemetry Strip */
.ht-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 1rem;
}

.ht-hud-metrics {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.ht-metric {
  display: flex;
  flex-direction: column;
}

.ht-metric-val {
  font-family: var(--font-mono);
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
}

.ht-metric-lbl {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  font-weight: 700;
}

/* Direct In-Text Arena (Zero Layout Shift / Zero Jump) */
.ht-words-window {
  position: relative;
  overflow: hidden;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: text;
  user-select: none;
  outline: none;
}

.ht-words-window:focus-within,
.ht-words-window.is-focused {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.ht-words-track {
  position: relative;
  font-family: var(--font-mono);
  font-size: var(--ht-fs, 26px);
  line-height: 1.65;
  transition: transform 0.14s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ht-word {
  display: inline-block;
  margin-right: 0.48em;
  border-radius: 4px;
}

.ht-char {
  display: inline-block;
  color: var(--ink-muted);
  transition: color 0.04s ease;
}

.ht-char.ok { color: var(--ink-strong); }
.ht-char.bad { color: var(--danger); background: var(--danger-soft); border-radius: 2px; }
.ht-char.extra { color: var(--danger); text-decoration: underline wavy; opacity: 0.9; }

.ht-word.word-ok .ht-char { color: var(--ink-done); }
.ht-word.word-bad { text-decoration: underline var(--danger); text-decoration-thickness: 2px; }

/* Smooth Gliding Caret + Ghost Cursor */
.ht-caret {
  position: absolute;
  width: 2.5px;
  background: var(--caret);
  border-radius: 2px;
  pointer-events: none;
  z-index: 12;
  transition: left 0.06s ease-out, top 0.06s ease-out;
  box-shadow: 0 0 10px var(--caret);
  animation: htCaretBlink 1s infinite ease-in-out;
}

@keyframes htCaretBlink {
  0%, 45% { opacity: 1; }
  55%, 100% { opacity: 0.3; }
}

.ht-ghost-caret {
  position: absolute;
  width: 2px;
  background: var(--ghost);
  pointer-events: none;
  z-index: 11;
  transition: left 0.14s linear, top 0.14s linear;
  opacity: 0.85;
}

.ht-opp-cursor {
  width: 1px !important;
  opacity: 0.38 !important;
  background: rgba(148, 163, 184, 0.45) !important;
}

.ht-opp-cursor .ht-ghost-tag,
.ht-opp-tag {
  opacity: 0.45 !important;
  font-weight: 600 !important;
  font-size: 0.6rem !important;
  padding: 0px 3px !important;
  background: rgba(100, 116, 139, 0.35) !important;
  color: rgba(255, 255, 255, 0.75) !important;
  box-shadow: none !important;
}

.ht-ghost-tag {
  position: absolute;
  top: -19px;
  left: 0;
  transform: translateX(-50%);
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 4px;
  color: #ffffff;
  white-space: nowrap;
  pointer-events: none;
}

.ht-hidden-input {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

.ht-stage-hint {
  margin-top: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--ink-muted);
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Buttons */
.ht-btn {
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--ink-strong);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.52rem 0.95rem;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  transition: all 0.15s ease;
}

.ht-btn:hover { border-color: var(--accent); color: var(--accent); }
.ht-btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #ffffff;
}
.ht-btn.primary:hover { filter: brightness(1.08); color: #ffffff; }

/* Multiplayer Lanes */
.ht-lanes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.ht-lane {
  display: grid;
  grid-template-columns: 28px 150px 1fr 75px;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.48rem 0.75rem;
}

.ht-lane.is-me { border-color: var(--accent); }
.ht-lane-rank { font-weight: 800; color: var(--ink-strong); text-align: center; }
.ht-lane-name { font-weight: 700; font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ht-lane-track {
  position: relative;
  height: 22px;
  background: var(--bg);
  border-radius: 999px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.ht-lane-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  border-radius: 999px;
  opacity: 0.3;
  transition: width 0.2s linear;
}
.ht-lane-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: left 0.2s linear;
}
.ht-lane-wpm { font-family: var(--font-mono); font-weight: 800; text-align: right; color: var(--ink-strong); }

/* Post-Test Analytics & Charts */
.ht-analytics-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.25rem;
  align-items: stretch;
}

.ht-kpi-stack {
  display: grid;
  gap: 0.65rem;
}

.ht-kpi-box {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
}

.ht-kpi-box.hero {
  background: linear-gradient(135deg, var(--accent-soft), transparent);
  border-color: var(--accent);
}

.ht-kpi-num {
  font-family: var(--font-mono);
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.05;
}

.ht-chart-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
}

.ht-chart-wrap canvas {
  width: 100%;
  height: 220px;
}

/* Keyboard Heatmap */
.ht-kb-wrap {
  margin-top: 1.15rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.ht-kb-row {
  display: flex;
  gap: 0.35rem;
}

.ht-key {
  min-width: 38px;
  height: 38px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--ink-strong);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 0.35rem;
}

.ht-key small { font-size: 0.6rem; opacity: 0.85; }

/* Tables */
.ht-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ht-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.ht-table th, .ht-table td {
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.ht-table th { color: var(--ink-muted); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; }

/* Footer */
.ht-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 0.9rem 1.25rem;
  font-size: 0.82rem;
  color: var(--ink-muted);
  transition: opacity 0.25s ease;
}

.ht-footer-inner {
  max-width: 1220px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

kbd {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

@media (max-width: 820px) {
  .ht-analytics-grid { grid-template-columns: 1fr; }
  .ht-lane { grid-template-columns: 24px 110px 1fr 60px; }
  .ht-key { min-width: 24px; height: 32px; font-size: 0.7rem; }
}

/* ==================== Typinge 9.31 3-Column Layout & Controls ==================== */
.tp-layout-wrap {
  max-width: 1420px;
  width: 100%;
  margin: 0 auto;
  padding: 0.7rem 1rem 1.5rem;
  display: grid;
  grid-template-columns: 185px minmax(0, 1fr) 235px;
  gap: 0.9rem;
  align-items: start;
}

body.tp-wide-stage .tp-sidebar { display: none; }
body.tp-wide-stage .tp-layout-wrap { grid-template-columns: minmax(0, 1fr); max-width: 1180px; }

.tp-center-col { min-width: 0; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.15rem; }
.tp-main-stage { min-width: 0; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }

.ht-seo-article {
  line-height: 1.72;
  color: var(--ink);
  font-size: 0.96rem;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.ht-seo-article img { max-width: 100%; height: auto; }
.ht-seo-article h2 {
  font-size: 1.28rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0.25rem 0 0.65rem;
}
.ht-seo-article h3 {
  font-size: 1.06rem;
  font-weight: 800;
  color: var(--ink);
  margin: 1.1rem 0 0.45rem;
}
.ht-seo-article h4 {
  font-size: 0.96rem;
  font-weight: 700;
  margin: 0.85rem 0 0.35rem;
}
.ht-seo-article p { margin: 0 0 0.72rem; color: var(--ink-muted); }
.ht-seo-article strong, .ht-seo-article b { color: var(--ink); }
.ht-seo-article ul, .ht-seo-article ol { margin: 0.4rem 0 0.85rem 1.3rem; color: var(--ink-muted); display: grid; gap: 0.3rem; }
.ht-seo-article kbd {
  display: inline-block; padding: 0.1rem 0.42rem; font-size: 0.82rem; font-weight: 700;
  border: 1px solid var(--border); border-radius: 5px; background: var(--surface-alt); color: var(--ink);
}
.ht-seo-article details.ht-faq-item, .ht-seo-article details {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  margin-bottom: 0.5rem;
  background: var(--surface-alt);
}
.ht-seo-article details summary {
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
}
.ht-seo-article details p { margin: 0.45rem 0 0.15rem; }
.ht-seo-table td, .ht-seo-table th { padding: 0.42rem 0.65rem; }
.ht-lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr));
  gap: 0.65rem;
  margin-top: 0.65rem;
}
.ht-lang-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  background: var(--surface-alt);
  display: grid;
  gap: 0.4rem;
}
.ht-lang-card-head { display: flex; justify-content: space-between; align-items: center; gap: 0.4rem; }
.ht-lang-card-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.tp-sidebar {
  position: sticky;
  top: 4.5rem;
  display: grid;
  gap: 0.85rem;
}

.tp-side-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.9rem;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.tp-side-hero-img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  display: block;
  margin: 0 auto 0.5rem;
}

.tp-side-title {
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--ink-strong);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.55rem;
}

.tp-side-list {
  list-style: none;
  display: grid;
  gap: 0.45rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink-muted);
}

.tp-side-links { display: grid; gap: 0.4rem; }
.tp-side-link, .tp-side-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--ink-strong);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.tp-side-link:hover, .tp-side-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.tp-lang-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tp-lang-chip {
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}
.tp-lang-chip:hover { border-color: var(--accent); color: var(--accent); }
.tp-side-pulse { font-size: 0.78rem; color: var(--ink-muted); display: grid; gap: 0.35rem; }

/* ==================== Studio Cards, Mode Bar & Curriculum Drawer ==================== */
.tp-studio-card { border-radius: 16px; min-width: 0; max-width: 100%; }
.tp-mode-topbar, .tp-mode-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.85rem;
  min-width: 0;
}
.tp-mode-pills, .tp-control-pills { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; min-width: 0; max-width: 100%; }

.tp-tab-pill {
  padding: 0.42rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}
.tp-tab-pill.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.tp-check-pill, .tp-slider-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.tp-slider-pill input { width: 72px; cursor: pointer; }

.tp-drawer-panel {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
  margin-bottom: 0.85rem;
  max-height: 310px;
  overflow-y: auto;
}
.tp-chapters-list { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.tp-chapter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem;
  min-width: 0;
}
.tp-chapter-title { font-weight: 800; font-size: 0.82rem; margin-bottom: 0.4rem; color: var(--accent); }
.tp-chapter-items { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.tp-drawer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(115px, 100%), 1fr)); gap: 0.4rem; }
.tp-drawer-item {
  padding: 0.32rem 0.55rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.tp-drawer-item.active, .tp-drawer-item:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.caps-warning-box {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}

.tp-live-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin-bottom: 0.85rem;
}
.tp-stat-badge {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.35rem 0.75rem;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.8rem;
}
.tp-stat-badge span { color: var(--ink-muted); font-weight: 600; }
.tp-stat-badge strong { color: var(--accent); font-size: 1rem; font-family: var(--font-mono); }

/* ==================== Lessons 4-Box Tile Drill, Word Stream & Paragraph Drill ==================== */
.tp-drill-stage {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.6rem;
}

.tp-4box-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}
.tp-4box-tile {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 15px;
  padding: 0.52rem 0.4rem;
  text-align: center;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.tp-4box-tile.is-current {
  border-color: var(--accent);
  background: #eff6ff;
  color: #0f172a;
  box-shadow: 0 5px 14px rgba(0, 102, 255, 0.18);
  transform: translateY(-1px);
}
.tp-4box-tile.is-done-ok { border-color: #10b981; background: rgba(16, 185, 129, 0.12); }
.tp-4box-tile.is-done-bad { border-color: var(--danger); background: var(--danger-soft); }
.tp-tile-glyph { font-size: 1.65rem; font-weight: 800; line-height: 1.15; }
.tp-tile-sub { font-family: var(--font-sans) !important; font-size: 0.65rem; font-weight: 700; color: var(--ink-muted); margin-top: 0.15rem; text-transform: uppercase; }

.tp-stream-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
  font-size: 1.25rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem 0.42rem;
}

.tp-tok {
  display: inline-block;
  padding: 0.06rem 0.32rem;
  border-radius: 6px;
  color: var(--ink-strong);
  transition: background 0.08s;
}
.tp-tok.is-ok { color: #15803d; background: rgba(22, 163, 74, 0.08); font-weight: 700; }
.tp-tok.is-bad { color: var(--danger); background: var(--danger-soft); font-weight: 700; text-decoration: line-through; }
.tp-tok.is-active {
  background: #fde047;
  color: #0f172a;
  border-bottom: 3px solid var(--accent);
  font-weight: 800;
}
.tp-tok.is-active.is-wrong-prefix {
  background: #fecdd3;
  border-bottom-color: var(--danger);
}

.tp-word-drill-stream {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  font-size: 1.35rem;
  line-height: 1.55;
}
.tp-word-drill-text { display: flex; flex-wrap: wrap; gap: 0.28rem 0.42rem; }
.tp-stream-icon { color: var(--accent); font-weight: 800; }

.tp-para-drill { display: grid; gap: 0.45rem; }
.tp-para-line {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font-size: 1.15rem;
  line-height: 1.5;
  display: flex;
  flex-wrap: wrap;
  gap: 0.22rem 0.38rem;
}
.tp-para-line.is-prev { opacity: 0.5; }
.tp-para-line.is-active { border-color: var(--accent); border-width: 2px; box-shadow: 0 3px 12px rgba(0, 102, 255, 0.12); align-items: center; }
.tp-enter-badge {
  font-family: var(--font-sans) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85em;
  font-weight: 800;
  color: var(--ink-muted);
  padding: 0 0.28rem;
  border-radius: 5px;
  border: 1px dashed transparent;
  margin-left: 0.15rem;
}
.tp-enter-badge.is-target {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 102, 255, 0.35);
}

.tp-input-bar { margin-bottom: 0.6rem; }
.tp-lesson-input, .tp-pr-textarea {
  width: 100%;
  padding: 0.58rem 0.85rem;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--ink-strong);
  font-size: 1.15rem;
  outline: none;
}
.tp-lesson-input:focus, .tp-pr-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tp-conv-textarea::placeholder,
.tp-lesson-input::placeholder,
.tp-pr-textarea::placeholder,
.is-legacy-font::placeholder {
  font-family: var(--font-sans) !important;
  font-size: 0.92rem;
  color: var(--ink-muted);
  opacity: 0.72;
}

[hidden] { display: none !important; }

.no-copy-zone, .ht-words-window, .tp-drill-stage, .tp-pr-prompt {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}

.tp-hand-drill-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  margin-bottom: 0.6rem;
}
.tp-hand-flank {
  flex: 0 0 58px;
  text-align: center;
}
.tp-hand-drill-row .tp-drill-stage {
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 0;
}
@media (max-width: 720px) {
  .tp-hand-flank { display: none; }
}

/* ==================== Typinge 15-Unit Pastel Virtual Keyboard & Dual Hand Guide ==================== */
.tp-vk-wrap { margin-top: 0.45rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.45rem; min-width: 0; max-width: 100%; }
.tp-finger-status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.tp-vk-board, .softkeyboard {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.42rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.tp-vk-row { display: flex; flex-wrap: nowrap; gap: 3px; width: 100%; min-width: 0; }
.tp-vk-key {
  position: relative;
  height: 50px;
  min-width: 0;
  border-radius: 6px;
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 2px 0 #94a3b8;
  color: #0f172a;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  padding: 3px 6px 4px;
  user-select: none;
  font-weight: 700;
  transition: transform 0.08s, box-shadow 0.08s;
  overflow: hidden;
  background: #ffffff;
}
.tp-vk-key.is-special {
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
}
.tp-vk-key.is-special,
.tp-vk-key.is-special .tp-vk-main {
  justify-content: center;
  align-self: center;
  text-align: center;
  font-family: var(--font-sans) !important;
  font-size: 0.7rem;
  font-weight: 700;
  color: #334155;
}
.tp-vk-key.is-special .tp-vk-top { display: none; }
.tp-vk-key.finger-LF1, .tp-vk-key.finger-RF5 { background: #dcf6ff; border-color: #b9e9fc; }
.tp-vk-key.finger-LF2, .tp-vk-key.finger-RF4 { background: #fcd1f3; border-color: #f7a9e6; }
.tp-vk-key.finger-LF3, .tp-vk-key.finger-RF3 { background: #dbf7d3; border-color: #b3f2a2; }
.tp-vk-key.finger-LF4 { background: #d1dbfa; border-color: #b1c1f5; }
.tp-vk-key.finger-RF2 { background: #edf2d1; border-color: #dbe4a2; }
.tp-vk-key.finger-LF5, .tp-vk-key.finger-RF1 { background: #f1f5f9; border-color: #cbd5e1; }
.tp-vk-key.is-home { box-shadow: inset 0 -3px 0 #334155, 0 2px 0 #94a3b8; }
.tp-vk-key.is-target {
  background: #2563eb !important;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.45);
  border-color: #1d4ed8 !important;
  z-index: 2;
}
.tp-vk-key.is-target .tp-vk-up, .tp-vk-key.is-target .tp-vk-qwerty { color: #dbeafe; opacity: 1; }
.tp-vk-top { display: flex; justify-content: space-between; width: 100%; align-items: center; line-height: 1.05; gap: 2px; }
.tp-vk-main { align-self: flex-start; text-align: left; font-size: 1.02rem; font-weight: 800; line-height: 1.06; }
.tp-vk-up { font-size: 0.72rem; font-weight: 700; color: #1e293b; text-align: left; }
.tp-vk-qwerty { font-size: 0.6rem; font-weight: 700; opacity: 0.76; font-family: var(--font-sans); color: #334155; text-align: right; margin-left: auto; }

.tp-hands-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.42rem 0.85rem;
}
.tp-hand-box { text-align: center; }
.tp-hand-stack { position: relative; width: 56px; height: 78px; margin: 0 auto; }
.tp-hand-base, .tp-hand-overlay {
  position: absolute;
  inset: 0;
  width: 56px;
  height: 78px;
  object-fit: contain;
}
.tp-hand-overlay { filter: none; }
.tp-hand-caption { font-size: 0.7rem; font-weight: 700; color: var(--ink-muted); margin-top: 0.15rem; }
.tp-finger-center { text-align: center; min-width: 180px; }
.tp-finger-pill {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  font-size: 0.82rem;
}

/* ==================== 10-Key Visual Numpad & Multi-Lang Code Stage ==================== */
.tp-np-layout {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.tp-np-board {
  display: grid;
  grid-template-columns: repeat(4, 56px);
  grid-auto-rows: 46px;
  gap: 4px;
  padding: 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  flex: 0 0 auto;
}
.tp-np-key {
  height: 100%;
  justify-content: center !important;
  font-size: 0.95rem;
  white-space: pre-line;
  text-align: center;
  line-height: 1.1;
}
.tp-np-key.np-wide { grid-column: span 2; }
.tp-np-key.np-tall { grid-row: span 2; }
.tp-np-key.np-home { box-shadow: inset 0 -3px 0 #1e293b, 0 2px 0 #94a3b8; font-weight: 900; }

.tp-code-stage {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.65;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.18rem;
  margin-bottom: 0.65rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.tp-code-line { display: flex; align-items: baseline; gap: 0.75rem; padding: 0.12rem 0.4rem; border-radius: 6px; white-space: pre; }
.tp-code-line.is-done { opacity: 0.52; color: #86efac; }
.tp-code-line.is-active { background: rgba(59, 130, 246, 0.22); box-shadow: inset 3px 0 0 #3b82f6; }
.tp-code-ln { color: #64748b; user-select: none; min-width: 1.6rem; font-size: 0.8rem; }
.tp-c-ok { color: #4ade80; font-weight: 700; }
.tp-c-bad { background: rgba(244, 63, 94, 0.35); color: #fecdd3; border-radius: 3px; }
.tp-c-cur { background: #3b82f6; color: #ffffff; border-radius: 3px; padding: 0 1px; }

/* ==================== PSSSB Practice Mode & DP Diff ==================== */
.tp-pr-settings { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; }
.tp-pr-prompt {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  line-height: 1.85;
  margin-bottom: 0.75rem;
  max-height: 250px;
  overflow-y: auto;
  color: var(--ink-strong);
}
.tp-pw { padding: 0.08rem 0.22rem; border-radius: 4px; display: inline-block; }
.tp-pw.is-ok { color: #16a34a; }
.tp-pw.is-bad { color: var(--danger); text-decoration: underline wavy var(--danger); }
.tp-pw.is-active { background: #fde047; color: #0f172a; font-weight: 700; }

.tp-chunk-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.tp-result-card {
  margin-top: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
}
.tp-kpi-row-6 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.9rem;
}
.tp-dp-diff {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
  line-height: 1.8;
  font-size: 1rem;
  max-height: 220px;
  overflow-y: auto;
}
.tp-diff-ok { color: var(--ink); }
.tp-diff-wrong { background: var(--danger-soft); color: var(--danger); padding: 0.12rem 0.35rem; border-radius: 4px; display: inline-block; }
.tp-diff-wrong del { text-decoration: line-through; opacity: 0.85; }
.tp-diff-wrong strong { text-decoration: none; font-weight: 700; }
.tp-diff-skip { background: #fef3c7; color: #92400e; padding: 0.1rem 0.3rem; border-radius: 4px; font-size: 0.85em; }
.tp-diff-extra { background: #e0f2fe; color: #0369a1; padding: 0.1rem 0.3rem; border-radius: 4px; font-size: 0.85em; }

.tp-rating-inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.tp-stars-row { display: inline-flex; gap: 0.2rem; }
.tp-star-btn {
  background: none;
  border: none;
  font-size: 1.45rem;
  color: #cbd5e1;
  cursor: pointer;
  line-height: 1;
}
.tp-star-btn.is-lit { color: #f59e0b; }

/* ==================== Font Converter Studio ==================== */
.tp-conv-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 0.85rem;
}
.tp-conv-sel-wrap { display: grid; gap: 0.25rem; }
.tp-conv-sel-wrap select { width: 100%; }
.tp-conv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; margin-bottom: 0.75rem; }
.tp-conv-pane { display: grid; gap: 0.35rem; }
.tp-conv-pane-head { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; font-weight: 700; }
.tp-conv-textarea {
  width: 100%;
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-strong);
  font-size: 1.15rem;
  line-height: 1.55;
  resize: vertical;
}
.tp-conv-preview-wrap { margin-bottom: 0.75rem; }
.tp-conv-actions { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.tp-alert-warn {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.84rem;
}
.tp-mono-badge { font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-muted); }

/* ==================== Indigo-Purple UserPanel, Public Profile & Institute Portal ==================== */
.tp-gradient-hero {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  border-radius: 16px;
  padding: 1.35rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: 0 10px 28px rgba(102, 126, 234, 0.25);
}
.tp-hero-identity { display: flex; gap: 1rem; align-items: center; }
.tp-avatar-circle {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  border: 2px solid rgba(255, 255, 255, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55rem;
  font-weight: 800;
  color: #ffffff;
}
.tp-rank-badge {
  display: inline-block;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 0.78rem;
  font-weight: 800;
}
.tp-goal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 0.85rem; }
.tp-goal-track {
  height: 11px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  margin: 0.45rem 0;
}
.tp-goal-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #667eea, #764ba2); transition: width 0.35s ease; }
.tp-badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(175px, 100%), 1fr)); gap: 0.65rem; }
.tp-badge-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem;
  background: var(--surface-elevated);
  opacity: 0.52;
}
.tp-badge-item.is-unlocked {
  opacity: 1;
  background: var(--surface);
  border-color: #667eea;
  box-shadow: 0 3px 12px rgba(102, 126, 234, 0.14);
}
.tp-medal-1 { background: #fef3c7 !important; color: #92400e !important; font-weight: 800; }
.tp-medal-2 { background: #f1f5f9 !important; color: #334155 !important; font-weight: 800; }
.tp-medal-3 { background: #ffedd5 !important; color: #9a3412 !important; font-weight: 800; }

.tp-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}
.tp-modal-backdrop[hidden] { display: none; }
.tp-modal-card {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
}

@media (max-width: 1120px) {
  .tp-layout-wrap { grid-template-columns: minmax(0, 1fr) 220px; }
  .tp-sidebar-left { display: none; }
}
@media (max-width: 992px) {
  .tp-layout-wrap { grid-template-columns: minmax(0, 1fr); }
  .tp-sidebar-right { display: none; }
  .tp-conv-grid, .tp-conv-toolbar { grid-template-columns: 1fr; }
  .tp-4box-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Slim Persistent Institute Banner for Enrolled Students */
.ht-inst-banner {
  max-width: 1460px;
  margin: 0.55rem auto 0;
  padding: 0.48rem 1rem;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(0, 102, 255, 0.1) 0%, rgba(118, 75, 162, 0.11) 100%);
  border: 1px solid rgba(0, 102, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.84rem;
  color: var(--ink);
}
[data-theme="heritage"] .ht-inst-banner {
  background: linear-gradient(90deg, rgba(217, 119, 6, 0.14) 0%, rgba(180, 83, 9, 0.08) 100%);
  border-color: rgba(217, 119, 6, 0.35);
}
[data-theme="midnight"] .ht-inst-banner {
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.14) 0%, rgba(129, 140, 248, 0.14) 100%);
  border-color: rgba(56, 189, 248, 0.35);
}
.ht-inst-banner[hidden] { display: none !important; }
.ht-inst-banner-left { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }
.ht-inst-badge {
  background: var(--accent);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
}
.ht-inst-banner-cta {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  padding: 0.22rem 0.6rem;
  border-radius: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.ht-inst-banner-cta:hover { border-color: var(--accent); }

/* Govt Exam Tools: Presets, Paper-to-Screen & A4 Print Sheet */
.ht-exam-preset-bar {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}
.ht-paper-banner {
  display: none;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  border: 1.5px dashed var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
  margin-bottom: 0.65rem;
}
.is-paper-mode .ht-paper-banner { display: block; }
.is-paper-mode .ht-words-window {
  height: 54px !important;
  opacity: 0.08;
  cursor: text;
}
.ht-print-sheet {
  display: none;
  margin-top: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: #0f172a;
}
.ht-print-sheet-body {
  font-size: 1.12rem;
  line-height: 1.85;
  margin-top: 0.85rem;
  white-space: pre-wrap;
}
@media print {
  body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='200' viewBox='0 0 320 200'%3E%3Cg transform='rotate(-30 160 100)'%3E%3Ctext x='160' y='105' text-anchor='middle' font-family='system-ui,-apple-system,Segoe UI,Roboto,sans-serif' font-size='18' font-weight='700' fill='%230f172a' fill-opacity='0.065'%3EHTyping.com %C2%B7 100%25 Free Forever%3C/text%3E%3C/g%3E%3C/svg%3E");
    background-repeat: repeat;
    background-position: 0 0;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  header, .ht-inst-banner, .tp-sidebar-left, .tp-sidebar-right,
  #ht-seo-article, footer, .ht-no-print, .ht-hud, .ht-stage-hint {
    display: none !important;
  }
  .tp-layout-wrap { display: block !important; padding: 0 !important; }
  .ht-card { border: none !important; box-shadow: none !important; padding: 0 !important; }
  .ht-print-sheet.is-printing { display: block !important; border: none !important; }
  .ht-scorecard-print { display: block !important; }
}

/* ==================== 100% Free Forever Education & Jobs Mission ==================== */
.free-mission-pill {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  width: 100%;
  max-width: 100%;
  margin: 0.55rem 0 0.75rem;
  padding: 0.42rem 0.72rem;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  color: var(--ink-strong);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.free-mission-pill i {
  color: var(--accent);
  margin-top: 0.14rem;
  flex-shrink: 0;
}
.free-mission-pill.is-compact {
  margin: 0.45rem 0 0;
  padding: 0.34rem 0.6rem;
  font-size: 0.74rem;
}

.ht-ai-practice-note {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0.4rem 0 0.72rem;
  padding: 0.42rem 0.72rem;
  border-radius: 10px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--ghost);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.42;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.ht-ai-practice-note .ht-ai-practice-icon {
  flex-shrink: 0;
  line-height: 1.35;
}
.ht-ai-practice-note strong {
  color: var(--ink-strong);
  font-weight: 700;
}
.ht-ai-practice-note.is-compact {
  margin: 0.35rem 0 0.55rem;
  padding: 0.34rem 0.6rem;
  font-size: 0.74rem;
}

.free-mission-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: 100%;
  max-width: 100%;
  margin: 0.65rem 0 0.85rem;
  padding: 0.68rem 0.9rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--surface-elevated) 100%);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.free-mission-banner i {
  color: var(--accent);
  font-size: 1rem;
  margin-top: 0.14rem;
  flex-shrink: 0;
}
.free-mission-banner strong {
  color: var(--ink-strong);
}

.ht-footer-mission {
  max-width: 1220px;
  margin: 0 auto 0.65rem;
}
.tp-side-mission {
  background: linear-gradient(160deg, var(--accent-soft) 0%, var(--surface) 100%);
  border-color: var(--border);
}
.tp-side-mission-text {
  font-size: 0.76rem;
  line-height: 1.48;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.tp-side-mission-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  margin-bottom: 0.45rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

@media (max-width: 960px) {
  .ht-topbar-inner { padding: 0.35rem 0.75rem; gap: 0.4rem; }
  .ht-domain-pill { display: none; }
  .ht-toolbar { gap: 0.35rem; }
  .ht-toolbar .ht-select { max-width: 145px; padding: 0.3rem 0.45rem; font-size: 0.78rem; }
  .ht-subnav-wrap { padding: 0.25rem 0.75rem; }
}

@media (max-width: 640px) {
  .ht-topbar-inner { padding: 0.3rem 0.55rem; gap: 0.28rem; }
  .ht-brand-name { font-size: 0.98rem; }
  .ht-pulse-mark { width: 24px; height: 24px; font-size: 0.85rem; border-radius: 7px; }
  .ht-toolbar { width: 100%; gap: 0.28rem; }
  .ht-toolbar .ht-status-chip { padding: 0.2rem 0.45rem; font-size: 0.7rem; }
  .ht-toolbar .ht-select {
    flex: 1 1 95px;
    min-width: 0;
    max-width: none;
    padding: 0.24rem 0.35rem;
    font-size: 0.73rem;
  }
  .ht-toolbar .ht-btn { padding: 0.24rem 0.52rem !important; font-size: 0.73rem !important; }
  .ht-subnav-wrap { padding: 0.2rem 0.55rem; }
  .ht-nav-item { font-size: 0.75rem; padding: 0.24rem 0.45rem; }

  .ht-inst-banner {
    margin: 0.45rem 0.55rem 0;
    padding: 0.42rem 0.65rem;
    gap: 0.4rem;
    font-size: 0.76rem;
  }
  .ht-inst-banner-left { gap: 0.35rem; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .ht-inst-banner-cta { font-size: 0.73rem; padding: 0.2rem 0.5rem; }

  .tp-layout-wrap { padding: 0.5rem 0.55rem 1.2rem; gap: 0.7rem; }
  .ht-card { padding: 0.75rem 0.78rem; border-radius: 12px; margin-bottom: 0.75rem; }
  .ht-card-head { gap: 0.5rem; margin-bottom: 0.75rem; }
  .ht-title { font-size: 1.08rem; }
  .ht-subtitle { font-size: 0.82rem; }
  .ht-btn { padding: 0.42rem 0.72rem; font-size: 0.82rem; }
  .tp-control-pills .ht-btn { max-width: 100%; white-space: normal; text-align: left; }
  .tp-tab-pill { padding: 0.34rem 0.62rem; font-size: 0.76rem; }

  .ht-hud { padding: 0.55rem 0.68rem; gap: 0.55rem; margin-bottom: 0.7rem; }
  .ht-hud-metrics { gap: 0.85rem; }
  .ht-metric-val { font-size: 1.25rem; }
  .ht-words-window { padding: 0.42rem 0.52rem; }
  .ht-words-track { font-size: clamp(17px, 4.8vw, 22px); line-height: 1.55; }

  .tp-live-strip { gap: 0.35rem; margin-bottom: 0.65rem; }
  .tp-stat-badge { padding: 0.26rem 0.5rem; font-size: 0.74rem; gap: 0.28rem; }
  .tp-stat-badge strong { font-size: 0.88rem; }

  .tp-drill-stage { padding: 0.5rem 0.58rem; }
  .tp-4box-grid { gap: 0.42rem; }
  .tp-4box-tile { padding: 0.4rem 0.3rem; border-radius: 11px; }
  .tp-tile-glyph { font-size: 1.35rem; }
  .tp-stream-preview { font-size: 1.05rem; padding: 0.38rem 0.55rem; }
  .tp-word-drill-stream { font-size: 1.1rem; padding: 0.55rem; }
  .tp-para-line { font-size: 0.98rem; padding: 0.45rem 0.58rem; }
  .tp-lesson-input, .tp-pr-textarea { font-size: 1rem; padding: 0.48rem 0.68rem; }

  /* Compact virtual keyboard fitting cleanly inside 360px phones */
  .tp-vk-board, .softkeyboard { padding: 0.24rem; gap: 2px; border-radius: 9px; }
  .tp-vk-row { gap: 2px; }
  .tp-vk-key {
    height: 35px;
    padding: 2px 1px;
    border-radius: 4px;
    border-width: 1px;
    box-shadow: 0 1px 0 #94a3b8;
  }
  .tp-vk-main { font-size: 0.72rem; line-height: 1; }
  .tp-vk-up { font-size: 0.52rem; }
  .tp-vk-qwerty { display: none; }
  .tp-vk-key.is-special { padding: 1px 2px; }
  .tp-vk-key.is-special .tp-vk-main {
    font-size: 0.48rem;
    letter-spacing: -0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .tp-hands-row { gap: 0.65rem; padding: 0.35rem 0.5rem; }

  /* Heatmap fit inside 360px cards */
  .ht-kb-wrap { width: 100%; gap: 2px; }
  .ht-kb-row { width: 100%; justify-content: center; gap: 2px; }
  .ht-key { min-width: 0; flex: 1 1 0; max-width: 30px; height: 30px; padding: 0 1px; font-size: 0.65rem; border-radius: 5px; }
  .ht-key small { font-size: 0.48rem; }

  /* Numpad & Code Studio */
  .tp-np-layout { gap: 0.7rem; }
  .tp-np-board {
    margin: 0 auto;
    grid-template-columns: repeat(4, minmax(46px, 54px));
    grid-auto-rows: 40px;
    padding: 0.38rem;
  }
  .tp-code-stage { font-size: 0.8rem; padding: 0.6rem 0.65rem; }

  .ht-table { font-size: 0.8rem; }
  .ht-table th, .ht-table td { padding: 0.42rem 0.38rem; }

  .tp-gradient-hero { padding: 0.95rem; gap: 0.75rem; border-radius: 13px; }
  .tp-avatar-circle { width: 48px; height: 48px; font-size: 1.25rem; }
  .tp-modal-backdrop { padding: 0.6rem; }
  .tp-modal-card { padding: 0.9rem; max-height: 90vh; overflow-y: auto; }

  .ht-footer { padding: 0.75rem 0.6rem; font-size: 0.76rem; }
  .free-mission-pill {
    font-size: 0.73rem;
    padding: 0.38rem 0.58rem;
    margin: 0.45rem 0 0.6rem;
  }
  .ht-ai-practice-note {
    font-size: 0.73rem;
    padding: 0.38rem 0.58rem;
    margin: 0.35rem 0 0.55rem;
  }
  .free-mission-banner {
    font-size: 0.77rem;
    padding: 0.58rem 0.7rem;
  }
}

@media (max-width: 480px) {
  .ht-lane { grid-template-columns: 20px 76px 1fr 48px; gap: 0.4rem; padding: 0.4rem 0.5rem; }
  .ht-lane-name { font-size: 0.76rem; }
  .ht-lane-wpm { font-size: 0.78rem; }
}

/* Soft-keyboard open on mobile phones (e.g. 390x420) */
@media (max-height: 520px) and (max-width: 900px) {
  .ht-topbar-inner { padding: 0.22rem 0.55rem; gap: 0.22rem; }
  .ht-toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .ht-toolbar::-webkit-scrollbar { display: none; }
  .ht-toolbar > * { flex: 0 0 auto; }
  .ht-toolbar .ht-select { flex: 0 0 auto; max-width: 130px; }
  .ht-subnav-wrap { padding: 0.16rem 0.55rem; }
  .ht-nav-item { padding: 0.2rem 0.42rem; font-size: 0.73rem; }
  .tp-pr-prompt { max-height: 135px; padding: 0.6rem 0.75rem; }
  .tp-4box-tile { padding: 0.28rem 0.25rem; }
  .tp-tile-glyph { font-size: 1.15rem; }
}
