/* =====================================================
   Typing Test Pro v1.1.0 — Scoped Premium Styles
   All rules scoped to #ttp-wrapper or #ttp-cert-page-wrapper
   ===================================================== */

/* ── Reset inside wrapper ── */
#ttp-wrapper *, #ttp-wrapper *::before, #ttp-wrapper *::after,
#ttp-cert-page-wrapper *, #ttp-cert-page-wrapper *::before, #ttp-cert-page-wrapper *::after,
#ttp-history-overlay *, #ttp-cert-overlay * {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

/* ── Outer wrapper ── */
#ttp-wrapper {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 20px 64px;
  color: #1a1a2e;
  background: transparent;
}

/* ── Views ── */
#ttp-main-view  { display: block; }
#ttp-results-view { display: none; }

/* ── Mode / time tabs ── */
.ttp-tabs-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 6px;
}
.ttp-tabs {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 0 4px;
}
#ttp-wrapper .ttp-tab {
  background: none;
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #9999b8;
  padding: 7px 15px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1;
}
#ttp-wrapper .ttp-tab:hover { color: #1a1a2e; background: rgba(108,99,255,0.08); }
#ttp-wrapper .ttp-tab.active { background: #6c63ff; color: #ffffff; font-weight: 600; }
.ttp-tab-divider { width: 1px; height: 18px; background: #dcdcf0; margin: 0 6px; flex-shrink: 0; }

/* ── Secondary option toggles ── */
.ttp-opts-wrap {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
#ttp-wrapper .ttp-opt-btn {
  background: none;
  border: 1px solid #dcdcf0;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #9999b8;
  padding: 4px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1.4;
}
#ttp-wrapper .ttp-opt-btn:hover { color: #6c63ff; border-color: #6c63ff; background: rgba(108,99,255,0.05); }
#ttp-wrapper .ttp-opt-btn.active { background: rgba(108,99,255,0.1); color: #6c63ff; border-color: #6c63ff; }

/* ── Custom text box ── */
#ttp-wrapper .ttp-custom-wrap {
  display: none;
  margin-bottom: 16px;
  background: #fff;
  border: 1px solid #dcdcf0;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 2px 8px rgba(108,99,255,0.04);
}
#ttp-wrapper .ttp-custom-wrap.visible { display: block; }
#ttp-wrapper .ttp-custom-label {
  font-size: 11px;
  font-weight: 700;
  color: #9999b8;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
#ttp-wrapper .ttp-custom-textarea {
  width: 100%;
  border: 1px solid #e0e0f0;
  border-radius: 8px;
  padding: 10px 14px;
  font-family: 'JetBrains Mono', 'Fira Mono', monospace;
  font-size: 14px;
  color: #1a1a2e;
  resize: none;
  height: auto;
  overflow: hidden;
  outline: none;
  transition: border-color 0.15s;
  background: #fafaff;
  line-height: 1.6;
  display: block;
}
#ttp-wrapper .ttp-custom-textarea:focus { border-color: #6c63ff; }
#ttp-wrapper .ttp-custom-apply {
  margin-top: 10px;
  background: #6c63ff;
  color: #fff;
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 18px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
#ttp-wrapper .ttp-custom-apply:hover { background: #5b52e6; }

/* ── Stats bar ── */
#ttp-wrapper .ttp-stats-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-top: 2px solid #eaeaf5;
  border-bottom: 2px solid #eaeaf5;
  margin-bottom: 28px;
  padding: 12px 0;
}
#ttp-wrapper .ttp-stat-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 8px;
  border-right: 1px solid #eaeaf5;
}
#ttp-wrapper .ttp-stat-cell:last-child { border-right: none; }
#ttp-wrapper .ttp-stat-cell-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9999b8;
  margin-bottom: 4px;
  font-family: 'Inter', sans-serif;
}
#ttp-wrapper .ttp-stat-cell-val {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a2e;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  font-family: 'Inter', sans-serif;
}
#ttp-wrapper .ttp-stat-cell-val.timer-val { color: #6c63ff; font-size: 22px; }
#ttp-wrapper .ttp-timer-warn  { color: #f59e0b !important; }
#ttp-wrapper .ttp-timer-danger { color: #ef4444 !important; }

/* ── Progress bar ── */
#ttp-wrapper .ttp-progress-wrap {
  height: 5px;
  background: #eaeaf5;
  border-radius: 3px;
  margin-bottom: 22px;
  overflow: hidden;
}
#ttp-wrapper .ttp-progress-fill {
  height: 100%;
  width: 100%;
  border-radius: 3px;
  background: linear-gradient(to right, #6c63ff, #a78bfa, #2dd4bf);
  transform-origin: left;
  transition: width 0.12s linear;
}
#ttp-wrapper .ttp-progress-fill.depleting { background: linear-gradient(to right, #ef4444, #f97316, #fbbf24); }

/* ── Typing area ── */
#ttp-wrapper .ttp-typing-area { position: relative; margin-bottom: 12px; cursor: text; }
#ttp-wrapper .ttp-words-wrapper {
  height: auto;
  overflow: hidden;
  position: relative;
  cursor: text;
  outline: none;
  transition: height 0.2s ease;
}
#ttp-wrapper .ttp-words-wrapper.code-wrap {
  height: 200px;
}
#ttp-wrapper .ttp-words-display {
  font-family: 'JetBrains Mono', 'Fira Mono', monospace;
  font-size: 24px;
  line-height: 1.6;
  color: #ccccdd;
  word-break: break-word;
  white-space: normal;
}
#ttp-wrapper .ttp-words-display.code-mode {
  white-space: pre;
  font-size: 16px;
  line-height: 1.75;
  tab-size: 2;
}
#ttp-wrapper .ttp-char { position: relative; }
#ttp-wrapper .ttp-char.correct { color: #9999b0; }
#ttp-wrapper .ttp-char.incorrect { color: #ef4444; text-decoration: underline wavy #ef4444; }
#ttp-wrapper .ttp-char.space.incorrect { background: rgba(239,68,68,0.1); border-radius: 2px; }
#ttp-wrapper .ttp-char.newline { display: inline; }
#ttp-wrapper .ttp-char.newline::after { content: '\21b5'; color: #ccccdd; opacity: 0.35; font-size: 0.7em; }

#ttp-caret {
  position: absolute;
  width: 2px;
  background: #6c63ff;
  border-radius: 2px;
  pointer-events: none;
  animation: ttp-blink 1s step-end infinite;
  z-index: 10;
}
@keyframes ttp-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

#ttp-hidden-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  top: 0;
  left: 0;
  pointer-events: none;
  font-size: 16px;
}

#ttp-wrapper .ttp-hint {
  text-align: center;
  font-size: 13px;
  color: #b0b0cc;
  margin-top: 10px;
  transition: opacity 0.3s;
  font-family: 'Inter', sans-serif;
}

/* ── Controls row ── */
#ttp-wrapper .ttp-controls-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
#ttp-wrapper .ttp-ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid #dcdcf0;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #9999b8;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}
#ttp-wrapper .ttp-ctrl-btn:hover:not(:disabled) { color: #6c63ff; border-color: #6c63ff; background: rgba(108,99,255,0.05); }
#ttp-wrapper .ttp-ctrl-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Keyboard Activity ── */
#ttp-wrapper .ttp-kb-section { margin-top: 36px; }
#ttp-wrapper .ttp-kb-section-title {
  font-size: 12px;
  font-weight: 700;
  color: #9999b8;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
  font-family: 'Inter', sans-serif;
}
#ttp-wrapper .ttp-keyboard {
  background: #eeeef8;
  border-radius: 14px;
  padding: 18px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}
#ttp-wrapper .ttp-key-row { display: flex; gap: 5px; align-items: flex-start; }
#ttp-wrapper .ttp-key {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid #d0d0e4;
  border-bottom: 3px solid #b8b8d0;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: #4a4a6a;
  cursor: default;
  user-select: none;
  min-width: 36px;
  height: 36px;
  padding: 2px 3px;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  text-align: center;
  line-height: 1.2;
}
#ttp-wrapper .ttp-key .key-top { font-size: 7.5px; color: #9999b8; line-height: 1; font-weight: 500; }
#ttp-wrapper .ttp-key.k-w1  { min-width: 54px; }
#ttp-wrapper .ttp-key.k-w15 { min-width: 62px; }
#ttp-wrapper .ttp-key.k-w2  { min-width: 72px; }
#ttp-wrapper .ttp-key.k-w25 { min-width: 82px; }
#ttp-wrapper .ttp-key.k-w3  { min-width: 90px; }
#ttp-wrapper .ttp-key.k-sp  { min-width: 240px; }
#ttp-wrapper .ttp-key.h1 { background: #fef9ec; border-color: #fcd34d; border-bottom-color: #f59e0b; color: #92400e; }
#ttp-wrapper .ttp-key.h1 .key-top { color: #b45309; }
#ttp-wrapper .ttp-key.h2 { background: #fff1e6; border-color: #fb923c; border-bottom-color: #ea580c; color: #7c2d12; }
#ttp-wrapper .ttp-key.h2 .key-top { color: #c2410c; }
#ttp-wrapper .ttp-key.h3 { background: #ffeaea; border-color: #f87171; border-bottom-color: #dc2626; color: #7f1d1d; }
#ttp-wrapper .ttp-key.h3 .key-top { color: #b91c1c; }

/* ── Paused overlay ── */
#ttp-paused-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(245,246,255,0.93);
  backdrop-filter: blur(4px);
  z-index: 5000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  font-family: 'Inter', sans-serif;
}
#ttp-paused-overlay.vis { display: flex; }
#ttp-paused-overlay h2 { font-size: 22px; font-weight: 700; color: #1a1a2e; margin: 0; }
#ttp-paused-overlay p  { font-size: 13px; color: #9999b8; margin: 0; }

/* ═══════════════════════════════════════════
   RESULTS VIEW
═══════════════════════════════════════════ */
#ttp-wrapper .ttp-results-title {
  font-size: 28px;
  font-weight: 800;
  color: #6c63ff;
  text-align: center;
  margin-bottom: 32px;
  letter-spacing: -0.5px;
  font-family: 'Inter', sans-serif;
}
#ttp-wrapper .ttp-results-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 40px;
  margin-bottom: 28px;
  align-items: start;
}
#ttp-wrapper .ttp-res-block { margin-bottom: 22px; }
#ttp-wrapper .ttp-res-block-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #9999b8;
  margin-bottom: 6px;
  font-family: 'Inter', sans-serif;
}
#ttp-wrapper .ttp-res-speed-row { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
#ttp-wrapper .ttp-res-wpm-big {
  font-size: 54px;
  font-weight: 800;
  color: #1a1a2e;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-family: 'Inter', sans-serif;
}
#ttp-wrapper .ttp-res-wpm-unit { font-size: 16px; font-weight: 500; color: #9999b8; }
#ttp-wrapper .ttp-res-wpm-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  vertical-align: middle;
  font-family: 'Inter', sans-serif;
}
#ttp-wrapper .badge-beginner    { background: #fee2e2; color: #dc2626; }
#ttp-wrapper .badge-normal      { background: #fef9c3; color: #a16207; }
#ttp-wrapper .badge-intermediate { background: #e0f2fe; color: #0369a1; }
#ttp-wrapper .badge-competent   { background: #dcfce7; color: #15803d; }
#ttp-wrapper .badge-proficient  { background: #ede9fe; color: #7c3aed; }
#ttp-wrapper .badge-expert      { background: #fef3c7; color: #b45309; }
#ttp-wrapper .ttp-res-sub { font-size: 12px; color: #b0b0cc; margin-top: 3px; }
#ttp-wrapper .ttp-res-acc-big {
  font-size: 38px;
  font-weight: 800;
  color: #1a1a2e;
  line-height: 1;
  font-family: 'Inter', sans-serif;
}
#ttp-wrapper .ttp-res-details-grid { display: grid; grid-template-columns: 1fr 1fr; }
#ttp-wrapper .ttp-res-detail-cell {
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f8;
}
#ttp-wrapper .ttp-res-detail-cell:nth-child(odd) { padding-right: 20px; }
#ttp-wrapper .ttp-res-detail-label { font-size: 12px; color: #9999b8; margin-bottom: 1px; font-family: 'Inter', sans-serif; }
#ttp-wrapper .ttp-res-detail-val  { font-size: 16px; font-weight: 700; color: #1a1a2e; font-family: 'Inter', sans-serif; }

/* Charts */
#ttp-wrapper .ttp-chart-block { margin-bottom: 22px; }
#ttp-wrapper .ttp-chart-block-heading {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 10px;
  font-family: 'Inter', sans-serif;
}
#ttp-wrapper .ttp-wpm-chart-wrap {
  background: #fff;
  border: 1px solid #eaeaf5;
  border-radius: 10px;
  padding: 12px;
}
#ttp-wrapper #ttp-wpm-chart { width: 100%; display: block; }

/* Error heat map */
#ttp-wrapper .ttp-heat-map { display: flex; flex-wrap: wrap; gap: 8px; }
#ttp-wrapper .ttp-heat-cell {
  background: #fef9ec;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 8px 12px;
  min-width: 58px;
  text-align: center;
  position: relative;
}
#ttp-wrapper .ttp-heat-cell.h2 { background: #fff1e6; border-color: #fb923c; }
#ttp-wrapper .ttp-heat-cell.h3 { background: #ffeaea; border-color: #f87171; }
#ttp-wrapper .ttp-heat-cell-rank {
  position: absolute;
  top: 3px;
  left: 6px;
  font-size: 9px;
  color: #9999b8;
  font-weight: 700;
}
#ttp-wrapper .ttp-heat-cell-char {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 700;
  color: #1a1a2e;
  line-height: 1.2;
}
#ttp-wrapper .ttp-heat-cell-count { font-size: 11px; font-weight: 600; color: #6b7280; }
#ttp-wrapper .ttp-heat-perfect { font-size: 13px; color: #15803d; font-weight: 500; display: flex; align-items: center; gap: 6px; }

/* Keyboard activity in results */
#ttp-wrapper .ttp-kb-result-bar {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #fbbf24, #f97316, #ef4444);
  margin-bottom: 5px;
}
#ttp-wrapper .ttp-kb-result-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #9999b8;
  margin-bottom: 14px;
  font-family: 'Inter', sans-serif;
}
#ttp-wrapper .ttp-kb-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
#ttp-wrapper .ttp-kb-stat-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: #9999b8; margin-bottom: 2px; font-family: 'Inter', sans-serif; }
#ttp-wrapper .ttp-kb-stat-val   { font-size: 14px; font-weight: 700; color: #1a1a2e; font-family: 'Inter', sans-serif; }

/* Action buttons */
#ttp-wrapper .ttp-action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 20px 0;
  border-top: 2px solid #eaeaf5;
  border-bottom: 2px solid #eaeaf5;
  margin-bottom: 32px;
}
#ttp-wrapper .ttp-action-btn,
#ttp-history-overlay .ttp-action-btn,
#ttp-cert-overlay .ttp-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 22px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}
#ttp-wrapper .ttp-btn-primary,
#ttp-history-overlay .ttp-btn-primary,
#ttp-cert-overlay .ttp-btn-primary { background: #6c63ff; color: #fff; }
#ttp-wrapper .ttp-btn-primary:hover,
#ttp-history-overlay .ttp-btn-primary:hover,
#ttp-cert-overlay .ttp-btn-primary:hover { background: #5b52e6; box-shadow: 0 4px 12px rgba(108,99,255,0.3); }
#ttp-wrapper .ttp-btn-secondary,
#ttp-cert-overlay .ttp-btn-secondary { background: #fff; color: #6c63ff; border: 1px solid #dcdcf0; }
#ttp-wrapper .ttp-btn-secondary:hover,
#ttp-cert-overlay .ttp-btn-secondary:hover { border-color: #6c63ff; background: #f5f4ff; }
#ttp-wrapper .ttp-btn-ghost { background: transparent; color: #9999b8; border: 1px solid #dcdcf0; }
#ttp-wrapper .ttp-btn-ghost:hover { color: #1a1a2e; border-color: #9999b8; }
#ttp-history-overlay .ttp-btn-danger { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }
#ttp-history-overlay .ttp-btn-danger:hover { background: #fecaca; }

/* ── History card (inline in results) ── */
#ttp-wrapper .ttp-history-card {
  background: #fff;
  border: 1px solid #eaeaf5;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(108,99,255,0.04);
  margin-bottom: 40px;
}
#ttp-wrapper .ttp-history-card-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid #eaeaf5;
}
#ttp-wrapper .ttp-history-card-title {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a2e;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
}
#ttp-wrapper .ttp-history-dot { width: 8px; height: 8px; background: #6c63ff; border-radius: 50%; flex-shrink: 0; }
#ttp-wrapper .ttp-history-clear {
  font-size: 13px;
  font-weight: 500;
  color: #9999b8;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: color 0.15s;
  padding: 0;
}
#ttp-wrapper .ttp-history-clear:hover { color: #ef4444; }

/* History tables */
#ttp-wrapper .ttp-history-tbl,
#ttp-history-overlay .ttp-history-tbl,
#ttp-cert-page-wrapper .ttp-history-tbl { width: 100%; border-collapse: collapse; }
#ttp-wrapper .ttp-history-tbl th,
#ttp-history-overlay .ttp-history-tbl th,
#ttp-cert-page-wrapper .ttp-history-tbl th {
  text-align: left;
  padding: 10px 22px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9999b8;
  border-bottom: 1px solid #f0f0f8;
  background: #fafaff;
  font-family: 'Inter', sans-serif;
}
#ttp-wrapper .ttp-history-tbl td,
#ttp-history-overlay .ttp-history-tbl td,
#ttp-cert-page-wrapper .ttp-history-tbl td {
  padding: 12px 22px;
  font-size: 13px;
  color: #1a1a2e;
  border-bottom: 1px solid #f5f5fb;
  font-family: 'Inter', sans-serif;
}
#ttp-wrapper .ttp-history-tbl tbody tr:last-child td,
#ttp-history-overlay .ttp-history-tbl tbody tr:last-child td { border-bottom: none; }
#ttp-wrapper .ttp-history-tbl tbody tr:hover td,
#ttp-history-overlay .ttp-history-tbl tbody tr:hover td { background: #f8f8ff; }
.ttp-hist-wpm { font-weight: 700; color: #6c63ff; font-size: 14px; }
.ttp-hist-acc { font-weight: 600; color: #22c55e; }
.ttp-mode-chip {
  display: inline-block;
  background: #f0efff;
  color: #6c63ff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: capitalize;
  font-family: 'Inter', sans-serif;
}
.ttp-mode-chip.mode-quotes  { background: #f0fdf4; color: #15803d; }
.ttp-mode-chip.mode-code    { background: #eff6ff; color: #1d4ed8; }
.ttp-mode-chip.mode-numbers { background: #fefce8; color: #a16207; }
.ttp-mode-chip.mode-custom  { background: #fdf4ff; color: #7e22ce; }
.ttp-hist-cert-link {
  background: none;
  border: 1px solid #dcdcf0;
  color: #6c63ff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.15s;
}
.ttp-hist-cert-link:hover { background: #f0efff; border-color: #6c63ff; }

/* ═══════════════════════════════════════════
   HISTORY MODAL (mid-test access)
═══════════════════════════════════════════ */
#ttp-history-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  font-family: 'Inter', sans-serif;
}
#ttp-history-overlay.open { opacity: 1; pointer-events: all; }
#ttp-history-modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.12);
  width: 100%;
  max-width: 840px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(14px) scale(0.98);
  transition: transform 0.2s;
}
#ttp-history-overlay.open #ttp-history-modal { transform: translateY(0) scale(1); }
#ttp-history-overlay .ttp-modal-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid #eaeaf5;
}
#ttp-history-overlay .ttp-modal-title { font-size: 16px; font-weight: 700; color: #1a1a2e; margin: 0; }
#ttp-history-overlay .ttp-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #9999b8;
  padding: 2px 8px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s;
}
#ttp-history-overlay .ttp-modal-close:hover { color: #1a1a2e; }
#ttp-history-overlay .ttp-modal-body { padding: 0; overflow-x: auto; }
#ttp-history-overlay .ttp-modal-ftr {
  display: flex;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid #eaeaf5;
}

/* ═══════════════════════════════════════════
   CERTIFICATE MODAL
═══════════════════════════════════════════ */
#ttp-cert-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  font-family: 'Inter', sans-serif;
}
#ttp-cert-overlay.open { opacity: 1; pointer-events: all; }
#ttp-cert-overlay .ttp-cert-modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.12);
  width: 100%;
  max-width: 920px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(14px) scale(0.98);
  transition: transform 0.2s;
}
#ttp-cert-overlay.open .ttp-cert-modal { transform: translateY(0) scale(1); }
#ttp-cert-overlay .ttp-cert-modal-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 26px;
  border-bottom: 1px solid #eaeaf5;
}
#ttp-cert-overlay .ttp-cert-modal-title { font-size: 16px; font-weight: 700; color: #1a1a2e; }
#ttp-cert-overlay .ttp-cert-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #9999b8;
  padding: 2px 8px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s;
}
#ttp-cert-overlay .ttp-cert-modal-close:hover { color: #1a1a2e; }
#ttp-cert-overlay .ttp-cert-modal-body { padding: 24px 26px; }
#ttp-cert-overlay .ttp-cert-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
#ttp-cert-overlay .ttp-cert-name-lbl { font-size: 13px; color: #9999b8; white-space: nowrap; }
#ttp-cert-overlay .ttp-cert-name-in {
  flex: 1;
  min-width: 200px;
  background: #fafaff;
  border: 1px solid #dcdcf0;
  border-radius: 8px;
  padding: 9px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: #1a1a2e;
  outline: none;
  transition: border-color 0.15s;
}
#ttp-cert-overlay .ttp-cert-name-in:focus { border-color: #6c63ff; }
#ttp-cert-overlay .ttp-cert-canvas-wrap { text-align: center; overflow: auto; }
#ttp-cert-overlay canvas { max-width: 100%; border-radius: 8px; border: 1px solid #eaeaf5; }
#ttp-cert-overlay .ttp-cert-modal-ftr {
  display: flex;
  gap: 10px;
  padding: 16px 26px;
  border-top: 1px solid #eaeaf5;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════
   CERTIFICATE PAGE ([typing_certificate])
═══════════════════════════════════════════ */
#ttp-cert-page-wrapper {
  font-family: 'Inter', -apple-system, sans-serif;
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  color: #1a1a2e;
}
#ttp-cert-page-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eaeaf5;
}
#ttp-cert-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #6c63ff;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s;
}
#ttp-cert-back-link:hover { color: #5b52e6; }
#ttp-cert-page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
#ttp-cert-page-actions label { font-size: 13px; color: #9999b8; }
#ttp-cert-page-actions input[type="text"] {
  border: 1px solid #dcdcf0;
  border-radius: 8px;
  padding: 8px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: #1a1a2e;
  outline: none;
  transition: border-color 0.15s;
  background: #fafaff;
  min-width: 200px;
}
#ttp-cert-page-actions input[type="text"]:focus { border-color: #6c63ff; }
#ttp-cert-page-wrapper .ttp-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}
#ttp-cert-page-wrapper .ttp-btn-primary   { background: #6c63ff; color: #fff; }
#ttp-cert-page-wrapper .ttp-btn-primary:hover { background: #5b52e6; }
#ttp-cert-page-wrapper .ttp-btn-secondary { background: #fff; color: #6c63ff; border: 1px solid #dcdcf0; }
#ttp-cert-page-preview { text-align: center; margin-bottom: 40px; overflow-x: auto; }
#ttp-cert-page-preview canvas { max-width: 100%; border-radius: 10px; box-shadow: 0 4px 24px rgba(108,99,255,0.1); border: 1px solid #eaeaf5; }
#ttp-cert-page-analytics {
  background: #fff;
  border: 1px solid #eaeaf5;
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 2px 8px rgba(108,99,255,0.04);
}
#ttp-cert-page-analytics h2 { font-size: 20px; font-weight: 700; margin: 0 0 4px; color: #1a1a2e; }
.ttp-analytics-sub { font-size: 13px; color: #9999b8; margin-bottom: 24px; }
#ttp-anal-charts-row { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 24px; }
#ttp-cert-page-wrapper .ttp-anal-chart-wrap {
  flex: 1;
  min-width: 220px;
  background: #fafaff;
  border: 1px solid #eaeaf5;
  border-radius: 10px;
  padding: 14px;
}
#ttp-cert-page-wrapper .ttp-chart-block-heading { font-size: 12px; font-weight: 700; color: #9999b8; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
#ttp-cert-page-wrapper canvas { width: 100% !important; }
#ttp-cert-page-wrapper .ttp-btn-danger { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }
#ttp-cert-page-wrapper .ttp-btn-danger:hover { background: #fecaca; }

/* ── Responsive ── */
@media (max-width: 700px) {
  #ttp-wrapper .ttp-results-layout { grid-template-columns: 1fr; gap: 24px; }
  #ttp-wrapper .ttp-res-wpm-big { font-size: 42px; }
  #ttp-wrapper .ttp-words-display { font-size: 20px; }
  #ttp-wrapper .ttp-keyboard { padding: 10px 6px; gap: 5px; }
  #ttp-wrapper .ttp-key { min-width: 28px; height: 30px; font-size: 9px; }
  #ttp-wrapper .ttp-key.k-w1  { min-width: 40px; }
  #ttp-wrapper .ttp-key.k-w15 { min-width: 46px; }
  #ttp-wrapper .ttp-key.k-w2  { min-width: 52px; }
  #ttp-wrapper .ttp-key.k-w25 { min-width: 60px; }
  #ttp-wrapper .ttp-key.k-w3  { min-width: 68px; }
  #ttp-wrapper .ttp-key.k-sp  { min-width: 130px; }
  #ttp-wrapper .ttp-stats-bar { grid-template-columns: repeat(3, 1fr); }
  #ttp-wrapper .ttp-stat-cell:nth-child(3) { border-right: none; }
  #ttp-wrapper .ttp-stat-cell:nth-child(4),
  #ttp-wrapper .ttp-stat-cell:nth-child(5) { border-top: 1px solid #eaeaf5; }
}