/* ===================================================
   NCLI TYPING MASTER - COMPONENT STYLES
   Phase 1: UI Structure & Layout
=================================================== */

/* ==================== HERO SECTION ==================== */
.tp-hero {
  padding: 80px 0;
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  color: #fff;
}

.tp-hero-content {
  text-align: center;
}

.tp-hero .section-tag {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.tp-hero .hero-title {
  font-size: 48px;
  font-weight: 800;
  margin-bottom: 12px;
  color: #fff;
}

.tp-hero .hero-desc {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.9);
  max-width: 600px;
  margin: 0 auto;
}

/* ==================== MAIN SECTION ==================== */
.tp-main-section {
  padding: 60px 0;
}

/* ==================== LOGIN STATUS BANNER ==================== */
.tp-login-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.5;
}

.tp-login-banner i {
  font-size: 18px;
  flex-shrink: 0;
}

.tp-login-banner.logged-in {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.tp-login-banner.guest {
  background: #eff6ff;
  color: #1e3a8a;
  border: 1px solid #bfdbfe;
}

.tp-login-banner a {
  color: #2563eb;
  font-weight: 700;
  text-decoration: underline;
}

/* ==================== TAB NAVIGATION ==================== */
.tp-tabs-wrapper {
  margin-bottom: 40px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tp-tabs {
  display: flex;
  gap: 12px;
  min-width: min-content;
  padding-bottom: 8px;
}

.tp-tabs::-webkit-scrollbar {
  height: 4px;
}

.tp-tabs::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}

.tp-tabs::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

.tp-tabs::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.tp-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: 2px solid #e2e8f0;
  background: #fff;
  color: #475569;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s ease;
}

.tp-tab:hover {
  border-color: #2563eb;
  color: #2563eb;
  background: #eff6ff;
}

.tp-tab.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.tp-tab i {
  font-size: 16px;
}

/* ==================== PANELS CONTAINER ==================== */
.tp-panels-container {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tp-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tp-panel.active {
  display: block;
}

/* Panel Title */
.panel-title {
  margin-bottom: 32px;
}

.panel-title h2 {
  font-size: 28px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-title p {
  font-size: 14px;
  color: #64748b;
}

/* ==================== DASHBOARD COMPONENTS ==================== */

.dashboard-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.summary-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.05);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.summary-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 20px;
}

.summary-icon.blue {
  background: #2563eb;
}

.summary-icon.green {
  background: #4ade80;
}

.summary-icon.purple {
  background: #e879f9;
}

.summary-icon.orange {
  background: #facc15;
  color: #0f172a;
}

.summary-icon.teal {
  background: #14b8a6;
}

.summary-icon.red {
  background: #ef4444;
}

.summary-label {
  display: block;
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  font-weight: 600;
}

.summary-value {
  display: block;
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
}

.summary-badge {
  display: inline-block;
  margin-top: 4px;
  background: #f97316;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 999px;
}

/* Stats Grid */
.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.dash-stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.dash-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.dsc-icon {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
}

.dsc-icon.blue {
  background: #2563eb;
}

.dsc-icon.green {
  background: #4ade80;
}

.dsc-icon.purple {
  background: #e879f9;
}

.dsc-icon.orange {
  background: #facc15;
  color: #0f172a;
}

.dsc-info {
  flex: 1;
}

.dsc-label {
  display: block;
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.dsc-value {
  display: block;
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
}

.dsc-unit {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  font-weight: 500;
  margin-top: 2px;
}

/* ===================================================
   DARK MODE & MODERN UI ENHANCEMENTS
   =================================================== */

/* Text & Readability Overrides in Dark Mode */
body.dark .panel-title h2,
body.dark .summary-value,
body.dark .dash-card-header h3,
body.dark .cc-info h3,
body.dark .ai-info strong,
body.dark .pi-label,
body.dark .lesson-card h3,
body.dark .lesson-info-title,
body.dark .stat-value,
body.dark .result-value,
body.dark .cert-info-box strong,
body.dark .certificate-card h3,
body.dark .lobby-players-title,
body.dark .game-stat-value,
body.dark .coding-read-card strong {
  color: #f8fafc !important;
}

body.dark .panel-title p,
body.dark .summary-label,
body.dark .dsc-label,
body.dark .cc-info p,
body.dark .ai-info span,
body.dark .ai-time,
body.dark .lesson-card p,
body.dark .progress-count,
body.dark .certificate-card p,
body.dark .game-stat-label,
body.dark .lobby-wait,
body.dark .coding-read-card p {
  color: #94a3b8 !important;
}

/* Tab Navigation - Pill Style Enhancement */
.tp-tabs {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(12px);
  padding: 6px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

body.dark .tp-tabs {
  background: rgba(15, 23, 42, 0.4);
  border-color: rgba(148, 163, 184, 0.1);
}

.tp-tab {
  border: none !important;
  background: transparent !important;
  color: #64748b;
  border-radius: 99px;
  padding: 10px 24px;
}

body.dark .tp-tab {
  color: #94a3b8;
}

.tp-tab.active {
  background: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3) !important;
}

.tp-tab:hover:not(.active) {
  background: rgba(37, 99, 235, 0.1) !important;
  color: #2563eb !important;
}

body.dark .tp-tab:hover:not(.active) {
  background: rgba(37, 99, 235, 0.2) !important;
  color: #60a5fa !important;
}

/* Typing Area Inputs */
body.dark .typing-input,
body.dark .code-input,
body.dark .lesson-dropdown {
  background: rgba(15, 23, 42, 0.8) !important;
  color: #f8fafc !important;
  border-color: rgba(148, 163, 184, 0.2) !important;
}

body.dark .text-display,
body.dark .code-display {
  background: rgba(15, 23, 42, 0.5) !important;
  color: #e2e8f0 !important;
  border-color: rgba(148, 163, 184, 0.15) !important;
}

body.dark .tp-key {
  background: rgba(30, 41, 59, 0.8) !important;
  color: #e2e8f0 !important;
  border-color: rgba(148, 163, 184, 0.2) !important;
}

body.dark .tp-key.active {
  background: #2563eb !important;
  color: #fff !important;
}

body.dark .bg-light {
  background-color: transparent !important;
}


/* Dashboard Main Grid */
.dash-main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.dash-col-left,
.dash-col-right {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Dashboard Cards */
.dash-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.dash-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.dash-card-header {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.dash-card-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-card-header h3 i {
  color: #2563eb;
}

/* Continue Card */
.continue-card {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  color: #fff;
}

.cc-header {
  margin-bottom: 12px;
}

.continue-card .section-tag {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.cc-info h3 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
  color: #fff;
}

.cc-info p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 16px;
}

/* Chart Placeholder */
.chart-placeholder,
.chart-box {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border-radius: 8px;
  text-align: center;
  border: 1px solid #e2e8f0;
  padding: 20px;
}

.skeleton-chart {
  width: 100%;
  height: 180px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  border-radius: 6px;
  animation: skeleton-loading 1.5s infinite;
}

.chart-box p {
  margin-top: 16px;
  font-size: 13px;
  color: #94a3b8;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.placeholder-text {
  font-size: 13px;
  color: #94a3b8;
  margin-top: 12px;
}

/* Activity List */
.activity-list {
  max-height: 400px;
  overflow-y: auto;
}

.activity-list::-webkit-scrollbar {
  width: 6px;
}

.activity-list::-webkit-scrollbar-track {
  background: transparent;
}

.activity-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.activity-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.activity-empty {
  text-align: center;
  padding: 40px 20px;
  color: #64748b;
}

.activity-empty i {
  font-size: 32px;
  color: #cbd5e1;
  display: block;
  margin-bottom: 12px;
}

.activity-empty p {
  font-size: 14px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  transition: all 0.2s;
  margin-bottom: 8px;
}

.activity-item:hover {
  background: #f8fafc;
}

.ai-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #dcfce7;
  color: #22c55e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.ai-info {
  flex: 1;
  min-width: 0;
}

.ai-info strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 2px;
}

.ai-info span {
  display: block;
  font-size: 12px;
  color: #64748b;
}

.ai-time {
  font-size: 12px;
  color: #94a3b8;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Lessons Progress */
.lessons-progress {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.progress-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pi-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.pi-label {
  font-weight: 600;
  color: #0f172a;
}

.pi-count {
  color: #64748b;
  font-size: 12px;
}

.progress-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #1e40af);
  border-radius: 4px;
  transition: width 0.5s ease;
  width: 0%;
}

/* ==================== LESSON COMPONENTS ==================== */

/* Lessons Grid */
.lessons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* Lesson Skeleton */
.lesson-skeleton {
  height: 240px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  border-radius: 12px;
  animation: skeleton-loading 1.5s infinite;
}

.lesson-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lesson-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.lesson-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lesson-badge {
  display: inline-flex;
  padding: 8px 12px;
  background: #eff6ff;
  color: #2563eb;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.lesson-status {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.lesson-status.completed {
  background: #d1fae5;
  color: #047857;
}

.lesson-status.pending {
  background: #f8fafc;
  color: #475569;
}

.lesson-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.lesson-card p {
  color: #64748b;
  font-size: 14px;
  line-height: 1.7;
  margin: 0;
}

.lesson-stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: #475569;
  font-size: 13px;
}

.lesson-stats span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.lesson-card .btn-outline {
  align-self: flex-start;
  padding: 10px 16px;
}

/* ==================== PRACTICE COMPONENTS ==================== */

.practice-container {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Practice Header */
.practice-header {
  display: flex;
  gap: 24px;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e2e8f0;
}

.lesson-selector {
  flex: 1;
}

.lesson-selector label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.lesson-dropdown {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  color: #475569;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
}

.lesson-dropdown:hover {
  border-color: #cbd5e1;
}

.lesson-dropdown:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.lesson-info-title {
  font-size: 14px;
  color: #475569;
  font-weight: 600;
}

/* Typing Area */
.typing-area {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  background: #f8fafc;
  border-radius: 12px;
}

/* Stats Row */
.typing-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 16px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.stat-label {
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: #2563eb;
}

/* Progress Container */
.progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-container .progress-bar {
  flex: 1;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.progress-container .progress-fill {
  background: linear-gradient(90deg, #2563eb, #1e40af);
  height: 100%;
  border-radius: 3px;
}

.progress-text {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  min-width: 40px;
  text-align: right;
}

/* Text Display — fixed height, scrolls so typing area + keyboard stay visible */
.text-display {
  padding: 16px 20px;
  background: #fff;
  border-radius: 8px;
  height: 162px; /* ~3 lines of text; rolls line-by-line as you type */
  overflow-y: auto;
  display: block;
  text-align: left;
  border: 2px solid #e2e8f0;
  cursor: text;
  scroll-behavior: smooth;
}

.text-display > p {
  margin: 0;
  color: #94a3b8;
}

.typing-text-wrap {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 0; /* row gap between lines; words carry their own spaces */
  align-content: flex-start;
}

/* Each word is a single non-breaking flex item, so words never split across
   lines and the box can roll cleanly one line at a time. */
.tw-word {
  display: inline-flex;
  white-space: nowrap;
}

/* Backspace limit control */
.backspace-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
}

.backspace-control label {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#backspaceBtn #backspaceLeft {
  font-weight: 700;
  color: #2563eb;
}

#backspaceBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.typing-char {
  display: inline-flex;
  min-width: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 18px;
  line-height: 1.8;
  font-family: 'Courier New', monospace;
  color: #0f172a;
}

/* Soft block under the whole word the user is about to type */
.typing-char.current-word {
  background: rgba(37, 99, 235, 0.10);
}

.typing-char.correct {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

.typing-char.incorrect {
  background: rgba(239, 68, 68, 0.16);
  color: #b91c1c;
}

/* Strong, unmistakable cursor on the next letter to type */
.typing-char.active-char {
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  border-radius: 4px;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.30);
  animation: caretPulse 1s steps(2, end) infinite;
}

@keyframes caretPulse {
  50% { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0); }
}

.text-display p {
  font-size: 18px;
  line-height: 1.8;
  color: #0f172a;
  font-family: 'Courier New', monospace;
  word-wrap: break-word;
}

/* Typing Input */
.typing-input {
  padding: 12px;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  font-family: 'Courier New', monospace;
  transition: all 0.2s;
}

.typing-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.typing-input:disabled {
  background: #f8fafc;
  color: #94a3b8;
  cursor: not-allowed;
}

/* Practice Buttons */
.practice-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Results Grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.result-card {
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
  text-align: center;
}

.result-label {
  display: block;
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.result-value {
  display: block;
  font-size: 28px;
  font-weight: 800;
  color: #2563eb;
}

/* ==================== STATISTICS COMPONENTS ==================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.stat-card-large {
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.stat-card-large h3 {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 16px;
}

/* ==================== PROGRESS COMPONENTS ==================== */

.progress-tracker {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.progress-filters {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.filter-btn {
  padding: 8px 16px;
  border: 2px solid #e2e8f0;
  background: #fff;
  color: #475569;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: #cbd5e1;
  color: #1e293b;
}

.filter-btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.progress-timeline {
  max-height: 500px;
  overflow-y: auto;
}

.timeline-empty {
  text-align: center;
  padding: 60px 20px;
  color: #64748b;
}

.timeline-empty i {
  font-size: 48px;
  color: #cbd5e1;
  display: block;
  margin-bottom: 16px;
}

.timeline-empty p {
  font-size: 14px;
}

/* ==================== CERTIFICATES COMPONENTS ==================== */

.certificates-container {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.cert-info-box {
  background: #eff6ff;
  padding: 16px;
  border-radius: 8px;
  border-left: 4px solid #2563eb;
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.cert-info-box i {
  color: #2563eb;
  font-size: 18px;
  flex-shrink: 0;
}

.cert-info-box p {
  font-size: 13px;
  color: #0f172a;
}

.certificates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.certificate-card {
  background: #f8fafc;
  padding: 24px;
  border-radius: 12px;
  text-align: center;
  border: 2px solid #e2e8f0;
  transition: all 0.3s ease;
}

.certificate-card:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.2);
}

.cert-badge {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #1e40af);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.certificate-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
}

.certificate-card p {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 16px;
}

.cert-progress {
  margin-bottom: 16px;
}

.cert-progress .progress-bar {
  height: 6px;
  margin-bottom: 8px;
}

.progress-count {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}

.certificate-card .btn-outline {
  width: 100%;
}

/* ==================== CODING MODE COMPONENTS ==================== */

.coding-container {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.coding-header {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e2e8f0;
}

.language-tabs {
  display: flex;
  gap: 12px;
}

.lang-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 2px solid #e2e8f0;
  background: #fff;
  color: #475569;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.lang-tab:hover {
  border-color: #cbd5e1;
}

.lang-tab.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

/* Coding lesson picker (numbered chips: done / current / locked) */
.coding-lessons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 8px;
  max-height: 152px;
  overflow-y: auto;
  padding-right: 4px;
}

.coding-lesson-chip {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #e2e8f0;
  background: #fff;
  color: #475569;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.coding-lesson-chip:hover:not(.is-locked) {
  border-color: #2563eb;
}

.coding-lesson-chip.is-current {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.coding-lesson-chip.is-done {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}

.coding-lesson-chip.is-locked {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

.coding-lesson-title {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 16px;
}

.coding-lesson-select-wrap {
  display: grid;
  grid-template-columns: 140px minmax(220px, 1fr);
  gap: 10px;
  align-items: center;
  margin: 16px 0 10px;
}

.coding-lesson-select-wrap label {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
}

.coding-read-card {
  align-items: flex-start;
  gap: 12px;
  background: #ecfdf5;
  border: 1px solid #99f6e4;
  color: #134e4a;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 16px;
}

.coding-read-card .crc-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: #0f766e;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.coding-read-card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 14px;
  color: #0f172a;
}

.coding-read-card p {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.45;
}

.coding-read-card span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #0f766e;
}

.code-editor-wrapper {
  background: #1e293b;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  min-height: 200px;
  font-family: 'Courier New', monospace;
}

.code-display {
  overflow-x: auto;
  margin-bottom: 12px;
}

.code-display pre {
  margin: 0;
  padding: 0;
}

.code-display code {
  color: #e2e8f0;
  font-size: 14px;
  line-height: 1.6;
}

.code-input {
  width: 100%;
  padding: 12px;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
}

.code-input:focus {
  outline: none;
  border-color: #2563eb;
}

.coding-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.coding-stats .stat-item {
  background: #f8fafc;
}

.coding-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ==================== GAME COMPONENTS ==================== */

.game-container {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.game-canvas {
  width: 100%;
  height: 400px;
  background: #1e293b;
  border-radius: 8px;
  margin-bottom: 20px;
  display: block;
  border: 2px solid #e2e8f0;
}

.game-info {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.game-stat {
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
  text-align: center;
}

.game-stat-label {
  display: block;
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.game-stat-value {
  display: block;
  font-size: 28px;
  font-weight: 800;
  color: #2563eb;
}

.game-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.game-duration {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.game-duration label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.game-duration select {
  min-width: 110px;
}

.game-over {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.game-over-content {
  background: #fff;
  padding: 40px;
  border-radius: 16px;
  text-align: center;
  max-width: 400px;
}

.game-over-content h2 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 24px;
  color: #0f172a;
}

.game-final-score {
  margin-bottom: 24px;
}

.game-final-score p {
  font-size: 16px;
  margin-bottom: 8px;
  color: #475569;
}

.game-final-score p strong {
  color: #2563eb;
  font-weight: 700;
}

/* ==================== UTILITY CLASSES ==================== */

.btn-primary,
.btn-outline {
  cursor: pointer;
  border: none;
  font-family: inherit;
  white-space: nowrap;
  transition: all 0.3s ease;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-outline:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==================== CERTIFICATE MODAL (ON SCREEN) ==================== */

.certificate-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 2000;
  overflow-y: auto;
}

.certificate-modal-inner {
  width: 100%;
  max-width: 760px;
}

.certificate-preview {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}

.certificate-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}

.certificate-modal-actions .btn-primary,
.certificate-modal-actions .btn-outline {
  padding: 12px 22px;
  border-radius: 8px;
  font-weight: 700;
}

.certificate-modal-actions .btn-primary {
  background: #2563eb;
  color: #fff;
}

.certificate-modal-actions .btn-outline {
  background: #fff;
  color: #334155;
  border: 2px solid #e2e8f0;
}

/* ===== Premium certificate (shared look on screen + print) ===== */
.certificate-page {
  position: relative;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.06), transparent 55%),
    radial-gradient(circle at bottom left, rgba(37, 99, 235, 0.06), transparent 55%),
    #ffffff;
  border: 12px solid var(--cert-accent, #2563eb);
  padding: 40px 48px 52px;
  text-align: center;
  font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* decorative thin inner frame */
.certificate-page::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 2px solid var(--cert-accent, #2563eb);
  opacity: 0.45;
  pointer-events: none;
}

/* per-level accent colours */
.certificate-page.cert-beginner     { --cert-accent: #16a34a; }
.certificate-page.cert-intermediate { --cert-accent: #0d9488; }
.certificate-page.cert-advanced     { --cert-accent: #2563eb; }
.certificate-page.cert-master       { --cert-accent: #b45309; }

/* logo */
.cert-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
}

.cert-logo-mark {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--cert-accent, #2563eb);
  color: #fff;
  font-size: 24px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cert-logo-text { text-align: left; line-height: 1.15; }
.cert-logo-main { display: block; font-size: 22px; font-weight: 800; color: #0f172a; letter-spacing: 1px; }
.cert-logo-sub  { display: block; font-size: 10px; color: #64748b; font-weight: 600; }

.certificate-header {
  margin-bottom: 14px;
  padding-bottom: 12px;
}

.certificate-title {
  font-size: 32px;
  font-weight: 800;
  color: #0f172a;
  margin: 6px 0 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.certificate-subtitle {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--cert-accent, #2563eb);
  padding: 6px 18px;
  border-radius: 999px;
  letter-spacing: 0.5px;
}

.certificate-body { margin: 18px 0 22px; }

.certificate-recipient {
  font-size: 32px;
  font-weight: 800;
  color: var(--cert-accent, #2563eb);
  margin: 10px 0;
  font-family: Georgia, 'Times New Roman', serif;
}

.certificate-text {
  font-size: 14px;
  color: #475569;
  line-height: 1.7;
  max-width: 540px;
  margin: 6px auto;
}

/* stat badges */
.cert-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin: 20px 0 4px;
}

.cert-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cs-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--cert-accent, #2563eb);
  line-height: 1;
}

.cs-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  font-weight: 600;
  margin-top: 5px;
}

/* footer with date / seal / signature */
.certificate-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-top: 32px;
}

.cert-foot-col { flex: 1; text-align: center; }

.cert-foot-value {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
}

.signature-line {
  border-top: 2px solid #0f172a;
  width: 150px;
  margin: 0 auto 6px;
}

.signature-title {
  font-size: 11px;
  color: #475569;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.certificate-seal {
  width: 84px;
  height: 84px;
  flex-shrink: 0;
  border: 3px solid var(--cert-accent, #2563eb);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: var(--cert-accent, #2563eb);
  background: rgba(37, 99, 235, 0.06);
}

.cert-number {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

/* ==================== CHARTS ==================== */

.tp-chart {
  width: 100%;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tp-chart-svg {
  width: 100%;
  height: auto;
  max-height: 240px;
}

.tp-chart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  text-align: center;
  color: #94a3b8;
}

.tp-chart-empty i {
  font-size: 32px;
  color: #cbd5e1;
}

.tp-chart-empty p {
  font-size: 13px;
}

/* The dashboard chart-box should host charts directly (no skeleton bg) */
.chart-box#dashWpmChart {
  display: block;
  padding: 12px;
}

/* ==================== SESSION HISTORY LIST ==================== */

.tp-history {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 240px;
  overflow-y: auto;
}

.tp-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.thr-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.thr-main strong {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.thr-main span {
  font-size: 11px;
  color: #94a3b8;
}

.thr-stats {
  display: flex;
  gap: 14px;
  flex-shrink: 0;
  font-size: 12px;
  color: #64748b;
}

.thr-stats b {
  color: #2563eb;
  font-weight: 800;
}

/* ==================== PROGRESS TIMELINE ==================== */

.timeline-item {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 0 0 18px 6px;
}

.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 14px;
  bottom: 0;
  width: 2px;
  background: #e2e8f0;
}

.ti-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #2563eb;
  margin-top: 4px;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  z-index: 1;
}

.ti-body {
  flex: 1;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
}

.ti-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.ti-head strong {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.ti-date {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
}

.ti-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: #64748b;
}

.ti-tag {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
}

/* ==================== RACING GAME ==================== */

.race-container {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.race-setup {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e2e8f0;
}

.race-setup-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.race-theme-tabs {
  display: flex;
  gap: 8px;
}

.race-theme-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: 2px solid #e2e8f0;
  background: #fff;
  color: #475569;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.race-theme-btn:hover {
  border-color: #cbd5e1;
}

.race-theme-btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.race-theme-btn.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.race-stats-inline {
  display: flex;
  gap: 12px;
  margin-left: auto;
}

.race-stats-inline .stat-item {
  min-width: 84px;
}

/* Track */
.race-track {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 20px;
  background: #0f172a;
}

.race-track.theme-boat {
  background: linear-gradient(180deg, #0c4a6e 0%, #075985 100%);
}

.race-lane {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: center;
  gap: 10px;
}

.lane-label {
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.race-lane.player .lane-label {
  color: #fbbf24;
}

.lane-strip {
  position: relative;
  height: 42px;
  border-radius: 8px;
  background: #334155;
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent 28px,
    rgba(250, 204, 21, 0.55) 28px,
    rgba(250, 204, 21, 0.55) 48px
  );
  background-position: center;
  background-size: 100% 4px;
  background-repeat: no-repeat;
  overflow: hidden;
}

.theme-boat .lane-strip {
  background: #0ea5e9;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.25) 0,
    rgba(255, 255, 255, 0.25) 10px,
    transparent 10px,
    transparent 30px
  );
  background-position: center;
  background-size: 100% 6px;
  background-repeat: no-repeat;
}

.race-lane.player .lane-strip {
  box-shadow: inset 0 0 0 2px rgba(251, 191, 36, 0.6);
}

.lane-vehicle {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  font-size: 24px;
  line-height: 1;
  transition: left 0.12s linear;
  z-index: 2;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.4));
}

/* Car emojis face left by default — flip so they point forward (right) */
.race-track.theme-car .lane-vehicle {
  transform: translateY(-50%);
}

.lane-finish {
  position: absolute;
  top: 0;
  right: 4px;
  height: 100%;
  display: flex;
  align-items: center;
  color: #fff;
  font-size: 16px;
  opacity: 0.8;
  z-index: 1;
}

.race-typing {
  margin-bottom: 16px;
}

.race-typing .text-display {
  margin-bottom: 12px;
}

.race-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Result overlay */
.race-result {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  padding: 20px;
  z-index: 10;
}

.race-result-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  max-width: 460px;
  width: 100%;
}

.race-result-emoji {
  font-size: 56px;
  margin-bottom: 8px;
}

.race-result-card h2 {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 20px;
}

.race-result-card .results-grid {
  margin-bottom: 24px;
}

/* ==================== ONLINE RACE ==================== */

.online-container {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Home (create / join) */
.online-name-row {
  max-width: 420px;
  margin: 0 auto 24px;
}

.online-name-row label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.online-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  max-width: 720px;
  margin: 0 auto;
}

.online-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
}

.oc-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: #2563eb;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.oc-icon.green { background: #16a34a; }

.online-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
}

.online-card p {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 16px;
}

.online-card .full-width { width: 100%; }

.online-code-input {
  text-align: center;
  letter-spacing: 4px;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.online-msg {
  text-align: center;
  margin-top: 18px;
  font-size: 14px;
  color: #64748b;
  min-height: 20px;
}

.online-msg.error { color: #dc2626; font-weight: 600; }

/* Lobby */
.lobby-code-box {
  text-align: center;
  background: linear-gradient(135deg, #2563eb, #1e40af);
  color: #fff;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.lobby-code-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.85;
}

.lobby-code-value {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 8px 0 4px;
}

.lobby-code-value span {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 6px;
}

.lobby-copy {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
}

.lobby-hint { font-size: 12px; opacity: 0.85; }

.lobby-players-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 14px;
}

.lobby-players {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.lobby-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.lobby-player.me {
  border-color: #2563eb;
  background: #eff6ff;
}

.lp-emoji { font-size: 22px; }

.lp-name {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lp-host {
  font-size: 10px;
  font-weight: 700;
  background: #fbbf24;
  color: #78350f;
  padding: 2px 8px;
  border-radius: 999px;
}

.lobby-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.lobby-wait {
  font-size: 13px;
  color: #64748b;
  font-style: italic;
}

/* Result */
.online-result {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  padding: 20px;
  z-index: 10;
}

.online-result-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  max-width: 480px;
  width: 100%;
}

.online-result-card h2 {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 20px;
}

.online-standings {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
  text-align: left;
}

.standing-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.standing-row.me {
  border-color: #2563eb;
  background: #eff6ff;
}

.sr-rank { font-size: 20px; min-width: 32px; text-align: center; }

.sr-name {
  flex: 1;
  font-weight: 700;
  color: #0f172a;
  font-size: 14px;
}

.sr-stats {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
}

/* ===================================================
   2026 PROFESSIONAL TYPING STUDIO UI
   Clear navigation, focused practice, premium polish
=================================================== */

.typing-app-container {
  --tp-primary: #6d5dfc;
  --tp-primary-dark: #4f46e5;
  --tp-cyan: #22d3ee;
  --tp-ink: #111827;
  --tp-muted: #69758b;
  --tp-line: #e5e9f2;
  --tp-panel: #ffffff;
  overflow: clip;
  background: #f5f7fb;
}

.tp-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 72px 0 86px;
  color: #fff;
  background:
    radial-gradient(circle at 11% 14%, rgba(99,102,241,.28), transparent 30%),
    radial-gradient(circle at 90% 80%, rgba(34,211,238,.17), transparent 30%),
    linear-gradient(135deg, #07111f 0%, #111a35 52%, #21124b 100%);
}

.tp-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  opacity: .38;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(to bottom, #000 20%, transparent 100%);
}

.tp-hero-orb { position: absolute; z-index: -1; border-radius: 50%; filter: blur(2px); pointer-events: none; }
.tp-orb-one { width: 360px; height: 360px; top: -210px; right: 17%; background: rgba(124,58,237,.22); }
.tp-orb-two { width: 260px; height: 260px; bottom: -190px; left: 42%; background: rgba(34,211,238,.14); }

.tp-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(410px, .95fr);
  align-items: center;
  gap: clamp(48px, 7vw, 110px);
}

.tp-hero-content { max-width: 720px; text-align: left; }

.tp-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
  padding: 8px 13px;
  border: 1px solid rgba(167,139,250,.3);
  border-radius: 999px;
  color: #dcd5ff;
  background: rgba(124,58,237,.12);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.tp-hero .hero-title {
  max-width: 720px;
  margin: 0 0 20px;
  color: #fff;
  font-size: clamp(42px, 4.9vw, 68px);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -.052em;
}

.tp-hero .hero-title span {
  color: transparent;
  background: linear-gradient(90deg, #a78bfa, #818cf8 48%, #67e8f9);
  -webkit-background-clip: text;
  background-clip: text;
}

.tp-hero .hero-desc { max-width: 620px; margin: 0 0 28px; color: #aeb9cc; font-size: 17px; line-height: 1.72; }
.tp-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 25px; }

.tp-hero-actions button {
  min-height: 49px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 12px;
  padding: 0 18px;
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.tp-hero-primary { border: 1px solid #6d5dfc; background: linear-gradient(135deg,#7c3aed,#4f46e5); box-shadow: 0 14px 30px rgba(79,70,229,.3); }
.tp-hero-secondary { border: 1px solid rgba(255,255,255,.17); background: rgba(255,255,255,.07); backdrop-filter: blur(10px); }
.tp-hero-actions button:hover { transform: translateY(-2px); box-shadow: 0 17px 36px rgba(2,6,23,.32); }

.tp-hero-proof { display: flex; flex-wrap: wrap; gap: 10px 18px; color: #c3ccda; font-size: 10px; font-weight: 700; }
.tp-hero-proof span { display: inline-flex; align-items: center; gap: 7px; }
.tp-hero-proof i { color: #5eead4; }

.tp-hero-visual { position: relative; min-height: 365px; }
.tp-speed-card {
  position: absolute;
  inset: 13px 8px 8px 12px;
  padding: 24px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(255,255,255,.11), rgba(255,255,255,.045));
  box-shadow: 0 34px 70px rgba(2,6,23,.36), inset 0 1px 0 rgba(255,255,255,.13);
  backdrop-filter: blur(16px);
  transform: perspective(900px) rotateY(-5deg) rotateX(2deg);
}

.tp-speed-card-head { display: flex; align-items: center; justify-content: space-between; color: #dbe4f3; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; }
.tp-speed-card-head span { display: flex; align-items: center; gap: 7px; }
.tp-speed-card-head span i { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52,211,153,.12); }
.tp-speed-card-head small { color: #7f8ca4; font-size: 8px; }

.tp-sample-line { margin: 37px 0 28px; color: #8e9bb0; font: 600 20px/1.8 'Courier New', monospace; }
.tp-sample-line .done { color: #6ee7b7; }
.tp-sample-line .current { padding: 4px 7px; border-radius: 6px; color: #fff; background: #7c3aed; box-shadow: 0 0 0 4px rgba(124,58,237,.15); }

.tp-visual-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 24px; }
.tp-visual-stats > div { padding: 11px; border: 1px solid rgba(255,255,255,.09); border-radius: 10px; background: rgba(2,6,23,.16); }
.tp-visual-stats small { display: block; margin-bottom: 5px; color: #8190a7; font-size: 8px; font-weight: 800; text-transform: uppercase; }
.tp-visual-stats strong { color: #fff; font-size: 18px; }
.tp-visual-stats em { color: #94a3b8; font-size: 8px; font-style: normal; }

.tp-mini-keyboard { display: grid; grid-template-columns: repeat(8,1fr); gap: 5px; }
.tp-mini-keyboard span { display: grid; place-items: center; height: 28px; border: 1px solid rgba(255,255,255,.1); border-radius: 6px; color: #9aa8bc; background: rgba(2,6,23,.24); box-shadow: inset 0 -2px 0 rgba(0,0,0,.2); font-size: 8px; font-weight: 800; }
.tp-mini-keyboard .pressed { color: #fff; border-color: #7c3aed; background: #7c3aed; transform: translateY(2px); box-shadow: none; }
.tp-mini-keyboard .next { color: #67e8f9; border-color: #22d3ee; }

.tp-floating-chip { position: absolute; z-index: 3; display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; border: 1px solid rgba(255,255,255,.14); border-radius: 10px; color: #e7edf7; background: rgba(9,16,31,.82); box-shadow: 0 14px 30px rgba(2,6,23,.28); backdrop-filter: blur(12px); font-size: 9px; font-weight: 800; }
.tp-floating-chip i { color: #a78bfa; }
.tp-chip-one { left: -23px; top: 70px; }
.tp-chip-two { right: -17px; bottom: 48px; }

.tp-main-section,
.tp-main-section.bg-light {
  padding: 42px 0 78px;
  background: radial-gradient(circle at 5% 5%, rgba(109,93,252,.075), transparent 22%), linear-gradient(180deg,#f8faff,#f3f5fa);
}

.tp-main-section > .container { max-width: 1500px; }
.tp-login-banner { margin: 0 0 20px; border-radius: 12px; box-shadow: 0 5px 18px rgba(30,41,59,.04); }

.tp-workspace {
  scroll-margin-top: 90px;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  align-items: start;
  gap: 20px;
}

.tp-tabs-wrapper {
  position: sticky;
  top: 88px;
  z-index: 9;
  display: flex;
  flex-direction: column;
  margin: 0;
  max-height: calc(100vh - 104px);
  overflow: hidden auto;
  border: 1px solid var(--tp-line);
  border-radius: 18px;
  padding: 9px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 18px 45px rgba(30,41,59,.09);
  backdrop-filter: blur(14px);
  scrollbar-width: thin;
}

.tp-nav-intro { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding: 10px 9px 13px; border-bottom: 1px solid #edf0f5; }
.tp-nav-logo { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 10px; color: #fff; background: linear-gradient(135deg,#7c3aed,#4f46e5); box-shadow: 0 8px 17px rgba(79,70,229,.22); }
.tp-nav-intro strong { display: block; color: var(--tp-ink); font-size: 11px; }
.tp-nav-intro small { display: block; margin-top: 2px; color: #9aa5b7; font-size: 8px; font-weight: 700; }

.typing-app-container .tp-tabs {
  display: flex;
  width: 100%;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
.tp-nav-group-label { padding: 11px 10px 4px; color: #a0a9b8; font-size: 7px; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }

.tp-tab {
  position: relative;
  width: 100%;
  min-height: 39px;
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  border: 0;
  border-radius: 9px;
  padding: 8px 10px;
  color: #657188;
  background: transparent;
  box-shadow: none;
  font-size: 10px;
  font-weight: 800;
  transition: .18s ease;
}

.tp-tab i { width: 17px; color: #8b96a9; font-size: 12px; text-align: center; transition: .18s ease; }
.tp-tab:hover { border: 0; color: #5b4be7; background: #f5f2ff; transform: translateX(2px); }
.tp-tab:hover i { color: #6d5dfc; }

.tp-tab.active {
  border: 0;
  color: #5b4be7;
  background: linear-gradient(90deg,#eeeaff,#f7f5ff);
  box-shadow: inset 0 0 0 1px rgba(109,93,252,.09);
}
.tp-tab.active::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 0 4px 4px 0; background: #6d5dfc; }
.tp-tab.active i { color: #6d5dfc; }

.typing-app-container .tp-tab.active {
  color: #5b4be7 !important;
  background: linear-gradient(90deg,#eeeaff,#f7f5ff) !important;
  box-shadow: inset 0 0 0 1px rgba(109,93,252,.09) !important;
}

.tp-nav-tip { display: flex; gap: 9px; margin-top: 9px; padding: 10px; border: 1px solid #ebe7ff; border-radius: 10px; color: #7a8496; background: #faf8ff; font-size: 8px; line-height: 1.45; }
.tp-nav-tip > i { color: #f59e0b; font-size: 13px; }
.tp-nav-tip strong { display: block; color: #4f5b70; font-size: 8px; }

.tp-panels-container { min-width: 0; }
.tp-panel.active {
  min-height: 720px;
  display: block;
  padding: clamp(20px, 2.5vw, 34px);
  border: 1px solid var(--tp-line);
  border-radius: 20px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 22px 60px rgba(30,41,59,.085);
  backdrop-filter: blur(10px);
}

.panel-title { position: relative; margin-bottom: 25px; padding-bottom: 18px; border-bottom: 1px solid #e9edf4; }
.panel-title h2 { margin: 0 0 5px; color: var(--tp-ink); font-size: clamp(23px,2.2vw,31px); letter-spacing: -.035em; }
.panel-title h2 i { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: #6d5dfc; background: #eeeaff; font-size: 14px; }
.panel-title p { margin: 0 0 0 48px; color: #8490a3; font-size: 11px; }

.dashboard-summary-grid { grid-template-columns: repeat(3,minmax(155px,1fr)); gap: 12px; margin-bottom: 22px; }
.summary-card { min-width: 0; gap: 12px; padding: 16px; border-color: #e7eaf1; border-radius: 13px; box-shadow: 0 5px 17px rgba(30,41,59,.045); }
.summary-card:hover { border-color: #cfc6ff; transform: translateY(-3px); box-shadow: 0 13px 27px rgba(79,70,229,.09); }
.summary-icon { width: 43px; height: 43px; flex: 0 0 43px; border-radius: 12px; font-size: 15px; }
.summary-icon.blue { color:#2563eb; background:#e8f0ff; }
.summary-icon.green { color:#059669; background:#dcfce7; }
.summary-icon.purple { color:#7c3aed; background:#f0e9ff; }
.summary-icon.orange { color:#d97706; background:#fff3d6; }
.summary-icon.teal { color:#0891b2; background:#dff8fb; }
.summary-icon.red { color:#e11d48; background:#ffe5ec; }
.summary-label { font-size: 8px; letter-spacing: .08em; }
.summary-value { color: #172033; font-size: 20px; }

.dash-main-grid { gap: 15px; }
.dash-card { border: 1px solid #e7eaf1; border-radius: 14px; box-shadow: 0 5px 17px rgba(30,41,59,.04); }
.dash-card:hover { box-shadow: 0 13px 28px rgba(30,41,59,.08); }
.continue-card { position: relative; overflow: hidden; border: 0; color: #fff; background: linear-gradient(135deg,#6d5dfc,#4f46e5 62%,#3730a3); box-shadow: 0 16px 34px rgba(79,70,229,.22); }
.continue-card::after { content:""; position:absolute; width:150px; height:150px; right:-60px; top:-70px; border-radius:50%; background:rgba(255,255,255,.1); }
.continue-card .section-tag { color:#e9e5ff; background:rgba(255,255,255,.13); }
.continue-card h3, .continue-card p { color:#fff; }
.continue-card .btn-primary { color:#4f46e5; background:#fff; box-shadow:none; }

.lessons-grid { grid-template-columns: repeat(auto-fill,minmax(225px,1fr)); gap: 14px; }
.lesson-card { position: relative; overflow: hidden; border: 1px solid #e5e9f1; border-radius: 14px; box-shadow: 0 5px 16px rgba(30,41,59,.04); }
.lesson-card::before { content:""; position:absolute; inset:0 auto 0 0; width:3px; background:linear-gradient(#7c3aed,#22d3ee); opacity:0; transition:.2s; }
.lesson-card:hover { border-color:#cfc7ff; transform:translateY(-4px); box-shadow:0 15px 30px rgba(79,70,229,.11); }
.lesson-card:hover::before { opacity:1; }

.practice-container { padding: 0; border: 0; border-radius: 15px; background: transparent; box-shadow: none; }
.practice-header { display:grid; grid-template-columns:minmax(210px,1fr) minmax(180px,.8fr) 150px; gap:12px; margin-bottom:14px; padding:14px; border:1px solid #e5e9f1; border-radius:13px; background:#fff; }
.lesson-selector label, .backspace-control label { color:#818da0; font-size:8px; letter-spacing:.1em; }
.lesson-dropdown { min-height:40px; border:1px solid #dfe4ed; border-radius:9px; color:#4f5c72; background:#fbfcfe; font-size:11px; }
.lesson-dropdown:focus { border-color:#7c3aed; box-shadow:0 0 0 3px rgba(124,58,237,.09); }
.lesson-info-title { display:flex; align-items:center; min-height:40px; color:#566278; font-size:11px; }

.typing-area { gap:14px; padding:16px; border:1px solid #e4e8f0; border-radius:15px; background:linear-gradient(180deg,#f8f9fd,#f3f5fa); }
.typing-stats { grid-template-columns:repeat(4,1fr); gap:8px; position:sticky; top:0; z-index:5; padding:8px 0; background:inherit; border-radius:10px; }
.typing-stats .stat-item { position:relative; overflow:hidden; min-height:66px; justify-content:center; border:1px solid #e6eaf1; border-radius:10px; box-shadow:none; }
.typing-stats .stat-item::before { content:""; position:absolute; left:0; top:0; bottom:0; width:3px; background:#7c3aed; }
.stat-label { margin-bottom:3px; color:#909bad; font-size:8px; letter-spacing:.08em; }
.stat-value { color:#5b4be7; font-size:20px; }

.progress-container .progress-bar { height:7px; border-radius:99px; background:#e0e5ee; }
.progress-container .progress-fill { border-radius:99px; background:linear-gradient(90deg,#7c3aed,#4f46e5,#22d3ee); box-shadow:0 0 12px rgba(109,93,252,.22); }

.text-display { height:174px; padding:20px 22px; border:1px solid #dfe4ed; border-radius:12px; background:#fff; box-shadow:inset 0 1px 0 #fff,0 8px 24px rgba(30,41,59,.055); }
.typing-char { padding:4px 5px; color:#263248; font-family:'Cascadia Code','Courier New',monospace; font-size:17px; }
.typing-char.current-word { background:rgba(109,93,252,.075); }
.typing-char.correct { color:#047857; background:rgba(16,185,129,.1); }
.typing-char.incorrect { color:#be123c; background:rgba(244,63,94,.13); }
.typing-char.shake-error { animation: ncliErrorShake .3s ease; }
@keyframes ncliErrorShake {
  0%,100% { transform:translateX(0); }
  20% { transform:translateX(-3px); }
  40% { transform:translateX(3px); }
  60% { transform:translateX(-2px); }
  80% { transform:translateX(2px); }
}
.typing-char.active-char { color:#fff; background:#6d5dfc; box-shadow:0 0 0 3px rgba(109,93,252,.2); }

.typing-input { min-height:47px; padding:11px 14px; border:1px solid #d8dee9; border-radius:10px; color:#172033; background:#fff; font-size:14px; }
.typing-input:focus { border-color:#7c3aed; box-shadow:0 0 0 4px rgba(124,58,237,.09); }

.tp-keyboard { padding:12px; border:1px solid #dfe4ed; border-radius:12px; background:#e9edf4; }
.tp-keyboard .kb-row { gap:5px; margin-bottom:5px; }
.tp-keyboard .kb-key { min-height:34px; border-color:#cfd5e0; border-radius:7px; color:#5d687b; background:#fff; box-shadow:0 3px 0 #cdd3de; font-size:9px; }
.tp-keyboard .kb-key.kb-next { color:#6d28d9; border-color:#8b5cf6; background:#ede9fe; box-shadow:0 3px 0 #c4b5fd; }
.tp-keyboard .kb-key.kb-active { color:#fff; border-color:#6d5dfc; background:#6d5dfc; box-shadow:0 1px 0 #4338ca; transform:translateY(2px); }

.practice-buttons { gap:8px; }
.practice-buttons .btn-primary, .practice-buttons .btn-outline { min-height:39px; border-radius:9px; padding:8px 13px; font-size:10px; }

.typing-app-container .typing-practice-layout {
  display:grid;
  grid-template-columns:minmax(0,1fr) 188px;
  gap:14px;
  align-items:start;
}

.typing-app-container .typing-practice-main {
  display:flex;
  min-width:0;
  flex-direction:column;
  gap:14px;
}

.typing-app-container .typing-control-panel {
  position:sticky;
  top:92px;
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:12px;
  border:1px solid #e0e6f0;
  border-radius:15px;
  background:linear-gradient(180deg,#fff,#f7f8fc);
  box-shadow:0 12px 28px rgba(30,41,59,.07);
}

.typing-app-container .typing-control-panel-head {
  padding-bottom:9px;
  border-bottom:1px solid #e9edf5;
}

.typing-app-container .typing-control-panel-head span {
  display:flex;
  align-items:center;
  gap:7px;
  color:#263248;
  font-size:12px;
  font-weight:900;
}

.typing-app-container .typing-control-panel-head i { color:#6d5dfc; }

.typing-app-container .typing-control-panel-head small {
  display:block;
  margin-top:3px;
  color:#8b96a8;
  font-size:9px;
  font-weight:700;
}

.typing-app-container .keyboard-toggle-btn {
  justify-content:center;
  width:100%;
  min-height:39px;
}

.typing-app-container .typing-control-panel .practice-buttons {
  display:grid;
  grid-template-columns:1fr;
  gap:8px;
  justify-content:stretch;
}

.typing-app-container .typing-control-panel .practice-buttons .btn-primary,
.typing-app-container .typing-control-panel .practice-buttons .btn-outline {
  justify-content:center;
  width:100%;
  min-height:40px;
  border-radius:10px;
}

.typing-app-container .tp-keyboard {
  display:flex;
  flex-direction:column;
  gap:7px;
  margin:0;
  padding:14px;
  overflow-x:auto;
  border:1px solid #dbe3ee;
  border-radius:18px;
  background:linear-gradient(145deg,#f9fbff,#e8edf6);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.75),0 12px 30px rgba(30,41,59,.08);
}

.typing-app-container .tp-keyboard.is-hidden { display:none; }

.typing-app-container .tp-keyboard .kb-row {
  display:flex;
  justify-content:center;
  gap:6px;
  min-width:690px;
  margin:0;
}

.typing-app-container .tp-keyboard .kb-key {
  display:flex;
  align-items:center;
  justify-content:center;
  min-width:38px;
  height:38px;
  border:1px solid rgba(148,163,184,.55);
  border-radius:10px;
  color:#334155;
  background:linear-gradient(180deg,#ffffff,#f1f5f9);
  box-shadow:0 4px 0 #cbd5e1,0 7px 16px rgba(15,23,42,.08);
  font-size:12px;
  font-weight:900;
  letter-spacing:.01em;
  transition:transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
}

.typing-app-container .tp-keyboard .kb-key::after { display:none; }

.typing-app-container .tp-keyboard .kb-key.kb-special {
  min-width:56px;
  color:#475569;
  background:linear-gradient(180deg,#f8fafc,#e2e8f0);
  font-size:10px;
}

.typing-app-container .tp-keyboard .kb-key.kb-space {
  flex:0 1 330px;
  min-width:260px;
}

.typing-app-container .tp-keyboard .kb-key.kb-next {
  color:#5b21b6;
  border-color:#a78bfa;
  background:linear-gradient(180deg,#f5f3ff,#ede9fe);
  box-shadow:0 4px 0 #c4b5fd,0 0 0 3px rgba(139,92,246,.13);
}

.typing-app-container .tp-keyboard .kb-key.kb-shift-needed,
.typing-app-container .tp-keyboard .kb-key.kb-active {
  color:#fff;
  border-color:#6d5dfc;
  background:linear-gradient(180deg,#7c3aed,#4f46e5);
  box-shadow:0 2px 0 #3730a3,0 10px 22px rgba(79,70,229,.28);
  transform:translateY(2px);
}

.stat-card-large, .progress-tracker, .certificates-container, .coding-container, .game-container, .race-container, .online-container { border:1px solid #e5e9f1; border-radius:15px; box-shadow:0 7px 22px rgba(30,41,59,.05); }

body.dark .typing-app-container { --tp-ink:#f4f7fb; --tp-muted:#9aa6b8; --tp-line:#263146; background:#080d18; }
body.dark .tp-main-section, body.dark .tp-main-section.bg-light { background:radial-gradient(circle at 5% 5%,rgba(109,93,252,.13),transparent 24%),#080d18; }
body.dark .tp-tabs-wrapper, body.dark .tp-panel.active { border-color:#263146; background:rgba(14,21,35,.92); }
body.dark .tp-nav-intro { border-color:#273247; }
body.dark .tp-nav-intro strong, body.dark .panel-title h2 { color:#f1f5f9; }
body.dark .tp-nav-tip { border-color:#34285a; color:#9aa6b8; background:#17152a; }
body.dark .tp-nav-tip strong { color:#d8dced; }
body.dark .tp-tab { color:#9ca7b9; }
body.dark .tp-tab:hover, body.dark .tp-tab.active { color:#c4b5fd; background:rgba(124,58,237,.15); }
body.dark .typing-app-container .tp-tabs {
  border:0 !important;
  border-radius:0;
  background:transparent !important;
  box-shadow:none !important;
  backdrop-filter:none;
}
body.dark .typing-app-container .tp-tab.active {
  color:#c4b5fd !important;
  background:linear-gradient(90deg,rgba(91,75,231,.24),rgba(30,41,59,.72)) !important;
  box-shadow:inset 0 0 0 1px rgba(139,92,246,.2),0 7px 18px rgba(2,6,23,.22) !important;
}
body.dark .panel-title { border-color:#283247; }
body.dark .summary-card, body.dark .dash-card, body.dark .lesson-card, body.dark .practice-header, body.dark .typing-stats .stat-item, body.dark .text-display, body.dark .typing-input { border-color:#293449; background:#111a2a; }
body.dark .summary-value, body.dark .typing-char, body.dark .typing-input { color:#e6ebf4; }
body.dark .typing-area { border-color:#293449; background:linear-gradient(180deg,#101827,#0d1421); }
body.dark .lesson-dropdown { border-color:#344055; color:#bac4d3; background:#111a2a; }
body.dark .typing-app-container .typing-control-panel { border-color:#293449; background:linear-gradient(180deg,#111a2a,#0d1421); box-shadow:0 12px 30px rgba(0,0,0,.25); }
body.dark .typing-app-container .typing-control-panel-head { border-color:#263146; }
body.dark .typing-app-container .typing-control-panel-head span { color:#e6ebf4; }
body.dark .typing-app-container .typing-control-panel-head small { color:#8895aa; }
body.dark .tp-keyboard { border-color:#2c374a; background:#0b1220; }
body.dark .tp-keyboard .kb-key { border-color:#344055; color:#aeb8c8; background:#192334; box-shadow:0 3px 0 #080d16; }
body.dark .typing-app-container .tp-keyboard {
  border-color:#2c374a !important;
  background:linear-gradient(145deg,#0b1220,#111a2a) !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.035),0 12px 30px rgba(0,0,0,.28) !important;
}
body.dark .typing-app-container .tp-keyboard .kb-key {
  border-color:#334155 !important;
  color:#cbd5e1;
  background:linear-gradient(180deg,#1e293b,#111827) !important;
  box-shadow:0 4px 0 #050914,0 8px 16px rgba(0,0,0,.24) !important;
}
body.dark .typing-app-container .tp-keyboard .kb-key.kb-special {
  color:#d4d9e5;
  background:linear-gradient(180deg,#24324a,#172033) !important;
}
body.dark .typing-app-container .tp-keyboard .kb-key.kb-next {
  color:#ddd6fe;
  border-color:#8b5cf6 !important;
  background:linear-gradient(180deg,rgba(91,75,231,.32),rgba(30,41,59,.88)) !important;
  box-shadow:0 4px 0 #312e81,0 0 0 3px rgba(139,92,246,.14) !important;
}
body.dark .typing-app-container .tp-keyboard .kb-key.kb-shift-needed,
body.dark .typing-app-container .tp-keyboard .kb-key.kb-active {
  color:#fff;
  border-color:#8b5cf6 !important;
  background:linear-gradient(180deg,#8b5cf6,#4f46e5) !important;
  box-shadow:0 2px 0 #312e81,0 10px 24px rgba(79,70,229,.34) !important;
}

@media (max-width: 1180px) {
  .tp-workspace { grid-template-columns:210px minmax(0,1fr); gap:14px; }
  .tp-panel.active { padding:22px; }
  .dashboard-summary-grid { grid-template-columns:repeat(2,minmax(150px,1fr)); }
  .tp-hero-grid { grid-template-columns:minmax(0,1fr) 390px; gap:35px; }
}

@media (max-width: 980px) {
  .tp-hero { padding:58px 0 67px; }
  .tp-hero-grid { grid-template-columns:1fr minmax(330px,.75fr); }
  .tp-hero-visual { min-height:330px; transform:scale(.9); transform-origin:center; }
  .tp-workspace { display:block; }
  .tp-tabs-wrapper { position:sticky; top:72px; display:block; max-height:none; margin-bottom:16px; overflow-x:auto; overflow-y:hidden; border-radius:14px; padding:7px; }
  .tp-nav-intro, .tp-nav-tip, .tp-nav-group-label { display:none; }
  .tp-tabs { width:max-content; min-width:100%; flex-direction:row; gap:5px; }
  .tp-tab { width:auto; min-height:38px; padding:8px 12px; }
  .tp-tab.active::before { display:none; }
  .tp-tab:hover { transform:none; }
  .tp-panel.active { min-height:650px; }
  .typing-app-container .typing-practice-layout { grid-template-columns:1fr; }
  .typing-app-container .typing-control-panel { position:static; }
  .typing-app-container .typing-control-panel .practice-buttons { grid-template-columns:repeat(5,minmax(0,1fr)); }
}

@media (max-width: 760px) {
  .tp-hero-grid { grid-template-columns:1fr; }
  .tp-hero-content { max-width:none; text-align:center; }
  .tp-hero .hero-desc { margin-left:auto; margin-right:auto; }
  .tp-hero-actions, .tp-hero-proof { justify-content:center; }
  .tp-hero-visual { display:none; }
  .tp-main-section, .tp-main-section.bg-light { padding:26px 0 55px; }
  .tp-login-banner { align-items:flex-start; padding:11px 13px; font-size:11px; }
  .tp-panel.active { min-height:0; padding:16px; border-radius:15px; }
  .panel-title { margin-bottom:18px; padding-bottom:14px; }
  .panel-title p { margin-left:0; margin-top:7px; }
  .dashboard-summary-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .summary-card { align-items:flex-start; flex-direction:column; padding:12px; }
  .summary-icon { width:36px; height:36px; flex-basis:36px; border-radius:10px; }
  .practice-header { grid-template-columns:1fr; padding:12px; }
  .typing-area { padding:12px; }
  .typing-stats { grid-template-columns:repeat(2,1fr); }
  .text-display { height:160px; padding:15px; }
  .tp-keyboard { overflow-x:auto; padding:9px; }
  .tp-keyboard .kb-row { min-width:660px; }
  .typing-app-container .typing-control-panel .practice-buttons { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .typing-app-container .keyboard-toggle-btn { min-height:42px; }
}

@media (max-width: 460px) {
  .tp-hero { padding:42px 0 50px; }
  .tp-hero .hero-title { font-size:36px; }
  .tp-hero .hero-desc { font-size:14px; }
  .tp-hero-actions button { width:100%; }
  .tp-hero-proof { display:grid; grid-template-columns:1fr 1fr; }
  .tp-tabs-wrapper { top:62px; margin-left:-5px; margin-right:-5px; }
  .tp-tab { padding:8px 10px; font-size:9px; }
  .dashboard-summary-grid { grid-template-columns:1fr 1fr; }
  .summary-value { font-size:18px; }
  .lessons-grid { grid-template-columns:1fr; }
  .practice-buttons { display:grid; grid-template-columns:1fr 1fr; }
  .practice-buttons .btn-primary, .practice-buttons .btn-outline { width:100%; }
  .typing-app-container .typing-control-panel .practice-buttons { grid-template-columns:1fr; }
  .typing-app-container .tp-keyboard .kb-row { min-width:620px; }
}

/* ==================== RACING GAME 2.0: CINEMATIC TYPING RACE ==================== */

.race-container {
  overflow: hidden;
  border: 1px solid rgba(139, 92, 246, .13);
  border-radius: 22px;
  padding: clamp(16px, 2.4vw, 28px);
  background:
    radial-gradient(circle at 12% 0%, rgba(124, 58, 237, .14), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(34, 211, 238, .13), transparent 26%),
    linear-gradient(180deg, rgba(255,255,255,.97), rgba(248,250,252,.94));
  box-shadow: 0 24px 70px rgba(30, 41, 59, .12);
}

.race-game-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.race-game-guide span {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #e7eafd;
  border-radius: 14px;
  color: #64748b;
  background: rgba(255,255,255,.86);
  box-shadow: 0 8px 22px rgba(30, 41, 59, .045);
  font-size: 11px;
  font-weight: 700;
}

.race-game-guide span i {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #22d3ee);
  box-shadow: 0 9px 18px rgba(124, 58, 237, .18);
}

.race-game-guide strong {
  color: #202a3c;
  font-weight: 900;
}

.race-setup {
  align-items: stretch;
  gap: 14px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid #e8ecf5;
  border-radius: 18px;
  background: rgba(255,255,255,.78);
  box-shadow: inset 0 1px 0 #fff, 0 10px 30px rgba(30, 41, 59, .045);
}

.race-setup-group {
  min-width: 160px;
}

.race-setup-group label {
  color: #8792a5;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .13em;
}

.race-theme-tabs {
  display: flex;
  gap: 8px;
}

.race-theme-btn {
  min-height: 42px;
  border: 1px solid #dfe5f0;
  border-radius: 13px;
  padding: 10px 15px;
  color: #526078;
  background: linear-gradient(180deg, #fff, #f8fafc);
  box-shadow: 0 8px 18px rgba(30, 41, 59, .045);
}

.race-theme-btn i {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #7c3aed;
  background: #f1edff;
}

.race-theme-btn:hover {
  border-color: #c4b5fd;
  transform: translateY(-1px);
}

.race-theme-btn.active {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  box-shadow: 0 16px 32px rgba(79, 70, 229, .22);
}

.race-theme-btn.active i {
  color: #fff;
  background: rgba(255,255,255,.16);
}

.race-theme-btn.locked {
  opacity: .55;
  transform: none;
}

.race-stats-inline {
  display: grid;
  grid-template-columns: repeat(4, minmax(78px, 1fr));
  gap: 8px;
  margin-left: auto;
}

.race-stats-inline .stat-item {
  min-width: 78px;
  border: 1px solid #e6eaf2;
  border-radius: 12px;
  background: rgba(255,255,255,.88);
  box-shadow: none;
}

.race-track {
  position: relative;
  display: block;
  isolation: isolate;
  min-height: 390px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 24px;
  overflow: hidden;
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), 0 24px 60px rgba(15, 23, 42, .16);
}

.race-track.theme-car {
  background:
    radial-gradient(circle at 24% 12%, rgba(59, 130, 246, .36), transparent 26%),
    linear-gradient(180deg, #10172d 0%, #172554 48%, #0b1220 100%);
}

.race-track.theme-boat {
  background:
    radial-gradient(circle at 82% 14%, rgba(251, 191, 36, .42), transparent 18%),
    linear-gradient(180deg, #0ea5e9 0%, #0284c7 45%, #075985 100%);
}

.race-scenery {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.city-skyline {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 122px;
  padding: 0 22px;
  opacity: .75;
}

.city-skyline i {
  flex: 1;
  min-width: 28px;
  border-radius: 7px 7px 0 0;
  background:
    repeating-linear-gradient(180deg, rgba(251, 191, 36, .48) 0 4px, transparent 4px 12px),
    linear-gradient(180deg, rgba(30, 41, 59, .92), rgba(2, 6, 23, .96));
  box-shadow: 0 -12px 30px rgba(59,130,246,.12);
}

.city-skyline i:nth-child(2n) { height: 72%; }
.city-skyline i:nth-child(3n) { height: 92%; }
.city-skyline i:nth-child(4n) { height: 56%; }
.city-skyline i:nth-child(5n) { height: 80%; }

.race-moon {
  position: absolute;
  right: 52px;
  top: 42px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #e0f2fe;
  box-shadow: 0 0 60px rgba(186, 230, 253, .55);
}

.ocean-sun {
  position: absolute;
  right: 62px;
  top: 34px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fde68a, #fb923c);
  box-shadow: 0 0 70px rgba(251, 191, 36, .55);
}

.race-cloud {
  position: absolute;
  width: 124px;
  height: 34px;
  border-radius: 999px;
  background: rgba(255,255,255,.7);
  filter: blur(.2px);
  animation: raceCloudDrift 20s linear infinite;
}

.race-cloud::before,
.race-cloud::after {
  content: "";
  position: absolute;
  bottom: 10px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: inherit;
}

.race-cloud::before { left: 20px; }
.race-cloud::after { right: 18px; width: 50px; height: 50px; }
.cloud-one { left: -140px; top: 42px; }
.cloud-two { left: 38%; top: 84px; transform: scale(.76); animation-duration: 28s; opacity: .55; }

.ocean-island {
  position: absolute;
  left: 30px;
  bottom: 22px;
  color: #fef3c7;
  font-size: 42px;
  opacity: .7;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,.24));
}

.race-game-hud {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(150px, .65fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.race-circuit-name {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 13px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 15px;
  background: rgba(2,6,23,.32);
  backdrop-filter: blur(12px);
}

.race-circuit-name small,
.race-boost-hud small {
  color: #aab7ce;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.race-circuit-name strong {
  color: #fff;
  font-size: 15px;
  letter-spacing: -.02em;
}

.race-live-feedback {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 150px;
  justify-content: center;
  padding: 12px 15px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 999px;
  color: #e0f2fe;
  background: rgba(2,6,23,.45);
  box-shadow: 0 12px 26px rgba(2,6,23,.24);
  backdrop-filter: blur(14px);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .09em;
}

.race-live-feedback i {
  color: #38bdf8;
}

.race-live-feedback.is-error {
  color: #fecaca;
  background: rgba(127, 29, 29, .58);
  animation: racePulse .36s ease;
}

.race-live-feedback.is-error i { color: #fb7185; }

.race-live-feedback.is-boost {
  color: #fef3c7;
  background: rgba(120, 53, 15, .58);
}

.race-live-feedback.is-boost i { color: #facc15; }

.race-boost-hud {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 15px;
  background: rgba(2,6,23,.32);
  backdrop-filter: blur(12px);
}

.race-boost-hud span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.race-boost-hud span i { color: #f97316; }
.race-boost-hud b { color: #facc15; }

.race-boost-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,.14);
}

.race-boost-track i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #facc15, #fb7185);
  transition: width .18s ease;
  box-shadow: 0 0 18px rgba(250, 204, 21, .42);
}

.race-lanes {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 12px;
}

.race-lane {
  display: grid;
  grid-template-columns: 86px 1fr;
  align-items: center;
  gap: 12px;
}

.lane-label {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-height: 60px;
  padding: 9px 10px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 15px;
  color: #dbeafe;
  background: rgba(2,6,23,.3);
  backdrop-filter: blur(10px);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: normal;
  overflow: visible;
}

.race-lane.player .lane-label {
  color: #fde68a;
  border-color: rgba(250, 204, 21, .45);
  background: rgba(113, 63, 18, .35);
}

.lane-label small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-width: 34px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #0f172a;
  background: #f8fafc;
  font-size: 9px;
  letter-spacing: 0;
}

.race-lane.player .lane-label small {
  background: #facc15;
}

.lane-strip {
  position: relative;
  height: 60px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), inset 0 -12px 24px rgba(0,0,0,.18);
}

.theme-car .lane-strip {
  background:
    linear-gradient(90deg, rgba(255,255,255,.04), transparent 18%, rgba(255,255,255,.04) 38%, transparent 60%),
    linear-gradient(180deg, #475569 0%, #263244 52%, #111827 100%);
}

.theme-car .lane-strip::before {
  content: "";
  position: absolute;
  left: -92px;
  right: -92px;
  top: 50%;
  height: 4px;
  transform: translate3d(0, -50%, 0);
  background: linear-gradient(90deg, transparent 0 31px, rgba(250,204,21,.92) 31px 59px, transparent 59px 92px);
  background-size: 92px 100%;
  background-repeat: repeat-x;
  opacity: .7;
  will-change: transform;
  animation: raceRoadMove 1.15s linear infinite;
}

.theme-boat .lane-strip {
  background:
    radial-gradient(circle at 12% 40%, rgba(255,255,255,.24) 0 2px, transparent 3px),
    linear-gradient(180deg, rgba(125,211,252,.55), rgba(14,165,233,.6) 50%, rgba(3,105,161,.72));
}

.theme-boat .lane-strip::before {
  content: "";
  position: absolute;
  inset: -24px -120px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.24) 0 11px, transparent 11px 38px),
    linear-gradient(35deg, rgba(255,255,255,.14) 0 9px, transparent 9px 34px);
  background-size: 120px 48px, 120px 48px;
  background-repeat: repeat;
  opacity: .65;
  will-change: transform;
  animation: raceWaterMove 3.2s linear infinite;
}

.race-lane.player .lane-strip {
  box-shadow: inset 0 0 0 2px rgba(250, 204, 21, .74), inset 0 -12px 24px rgba(0,0,0,.18), 0 0 0 5px rgba(250, 204, 21, .08);
}

.lane-start {
  position: absolute;
  left: 12px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 99px;
  background: rgba(255,255,255,.62);
}

.lane-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(139,92,246,.22), rgba(34,211,238,.16));
  transition: width .16s cubic-bezier(.2,.8,.2,1);
}

.lane-vehicle,
.race-track.theme-car .lane-vehicle,
.race-track.theme-boat .lane-vehicle {
  position: absolute;
  top: 50%;
  left: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 52px;
  height: 42px;
  transform: translate(-4px, -50%);
  font-size: 28px;
  line-height: 1;
  transition: left .16s cubic-bezier(.2,.82,.2,1);
  filter: drop-shadow(0 10px 12px rgba(0,0,0,.32));
}

.lane-vehicle i {
  position: relative;
  z-index: 2;
  color: var(--vehicle-color);
  text-shadow: 0 2px 0 rgba(255,255,255,.2), 0 0 18px color-mix(in srgb, var(--vehicle-color), transparent 52%);
}

.lane-vehicle i {
  transform-origin: center;
}

.race-track.theme-car .lane-vehicle i {
  transform: scaleX(1);
}

.race-track.theme-boat .lane-vehicle i {
  transform: scaleX(-1);
}

.lane-vehicle b {
  position: absolute;
  left: 50%;
  top: -1px;
  transform: translateX(-50%);
  padding: 2px 7px;
  border-radius: 999px;
  color: #111827;
  background: #facc15;
  box-shadow: 0 4px 10px rgba(0,0,0,.16);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .06em;
  z-index: 5;
  pointer-events: none;
}

.lane-vehicle b:empty {
  display: none;
}

.vehicle-shadow {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 1px;
  height: 8px;
  border-radius: 50%;
  background: rgba(0,0,0,.34);
  filter: blur(4px);
}

.vehicle-wake {
  position: absolute;
  right: 35px;
  width: 46px;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.62));
  opacity: .22;
  transform: scaleX(.75);
  transform-origin: right;
}

.theme-car .vehicle-wake {
  background: linear-gradient(90deg, transparent, rgba(251,146,60,.75));
}

.theme-boat .vehicle-wake {
  height: 18px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.78));
}

.lane-vehicle.moving {
  animation: vehicleBob .42s ease-in-out infinite;
}

.theme-boat .lane-vehicle.moving {
  animation-duration: .68s;
}

.lane-vehicle.boosting i {
  color: #facc15;
  filter: drop-shadow(0 0 18px rgba(250,204,21,.78));
}

.lane-vehicle.boosting .vehicle-wake {
  opacity: .72;
  transform: scaleX(1.3);
}

.lane-vehicle.slowed {
  animation: slowWobble .35s ease;
}

.lane-finish {
  position: absolute;
  top: 0;
  right: 8px;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #fff;
  opacity: .95;
}

.lane-finish span {
  width: 6px;
  height: 100%;
  background:
    linear-gradient(45deg, #fff 25%, #111827 25% 50%, #fff 50% 75%, #111827 75%) 0 0 / 12px 12px;
  box-shadow: 0 0 16px rgba(255,255,255,.18);
}

.lane-finish i {
  font-size: 17px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.28));
}

.race-countdown {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  background: radial-gradient(circle, rgba(15,23,42,.36), rgba(15,23,42,.68));
  backdrop-filter: blur(3px);
  transition: .24s ease;
}

.race-countdown span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 150px;
  padding: 15px 24px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  color: #fff;
  background: rgba(2,6,23,.44);
  box-shadow: 0 18px 44px rgba(2,6,23,.28);
  font-size: 25px;
  font-weight: 950;
  letter-spacing: .12em;
}

.race-countdown small {
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 700;
}

.race-countdown.hidden {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}

.race-track.has-error {
  animation: raceShake .24s ease;
}

.race-track.has-boost .race-lane.player .lane-strip {
  box-shadow: inset 0 0 0 2px rgba(250, 204, 21, .95), 0 0 30px rgba(250, 204, 21, .18);
}

.race-typing {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid #e7eaf1;
  border-radius: 17px;
  background: rgba(255,255,255,.82);
}

.race-typing .text-display {
  height: 166px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: #fbfcff;
}

.race-typing .typing-char.incorrect.active-char {
  color: #fff;
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239,68,68,.18);
}

.race-typing .typing-input {
  border-radius: 13px;
}

.race-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.race-result {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  padding: 20px;
  background: rgba(15, 23, 42, .58);
  backdrop-filter: blur(10px);
}

.race-result-card {
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 24px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 26px 80px rgba(2, 6, 23, .24);
}

.race-result-emoji {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(135deg, #f59e0b, #ef4444, #7c3aed);
  box-shadow: 0 18px 38px rgba(124, 58, 237, .25);
}

.race-result-emoji i {
  font-size: 34px;
}

body.dark .race-container {
  border-color: #293449;
  background:
    radial-gradient(circle at 12% 0%, rgba(124, 58, 237, .2), transparent 30%),
    radial-gradient(circle at 88% 12%, rgba(34, 211, 238, .16), transparent 28%),
    linear-gradient(180deg, #111827, #0b1220);
}

body.dark .race-game-guide span,
body.dark .race-setup,
body.dark .race-stats-inline .stat-item,
body.dark .race-typing {
  border-color: #293449;
  color: #aeb8c8;
  background: rgba(17, 24, 39, .88);
}

body.dark .race-game-guide strong {
  color: #f4f7fb;
}

body.dark .race-theme-btn {
  border-color: #344055;
  color: #c8d2e1;
  background: linear-gradient(180deg, #172033, #111827);
}

body.dark .race-typing .text-display {
  background: #101827;
}

body.dark .race-result-card {
  border-color: #334155;
  background: #111827;
}

@keyframes raceCloudDrift {
  from { transform: translateX(0) scale(var(--cloud-scale, 1)); }
  to { transform: translateX(calc(100vw + 260px)) scale(var(--cloud-scale, 1)); }
}

@keyframes raceRoadMove {
  from { transform: translate3d(0, -50%, 0); }
  to { transform: translate3d(-92px, -50%, 0); }
}

@keyframes raceWaterMove {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-120px, 0, 0); }
}

@keyframes vehicleBob {
  0%, 100% { transform: translate(-4px, -50%) translateY(0); }
  50% { transform: translate(-4px, -50%) translateY(-3px); }
}

@keyframes slowWobble {
  0%, 100% { transform: translate(-4px, -50%) rotate(0deg); }
  30% { transform: translate(-4px, -50%) rotate(-5deg); }
  65% { transform: translate(-4px, -50%) rotate(4deg); }
}

@keyframes raceShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
}

@keyframes racePulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.045); }
  100% { transform: scale(1); }
}

@media (max-width: 860px) {
  .race-game-guide { grid-template-columns: 1fr; }
  .race-setup { display: grid; grid-template-columns: 1fr 1fr; }
  .race-stats-inline { grid-column: 1 / -1; width: 100%; margin-left: 0; }
  .race-game-hud { grid-template-columns: 1fr; }
  .race-live-feedback { justify-self: stretch; }
  .race-boost-hud { width: 100%; }
}

@media (max-width: 620px) {
  .race-track { min-height: 360px; padding: 12px; border-radius: 18px; }
  .race-lane { grid-template-columns: 62px 1fr; gap: 8px; }
  .lane-label { min-height: 52px; padding: 8px 7px; font-size: 8px; }
  .lane-strip { height: 52px; border-radius: 14px; }
  .lane-vehicle,
  .race-track.theme-car .lane-vehicle,
  .race-track.theme-boat .lane-vehicle { width: 42px; height: 36px; font-size: 23px; }
  .race-setup { grid-template-columns: 1fr; }
  .race-stats-inline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .race-theme-tabs { width: 100%; }
  .race-theme-btn { flex: 1; justify-content: center; }
}

/* Racing Game 3.0: detailed cars and stronger road motion. */
.race-track.theme-car {
  min-height: 440px;
  background:
    linear-gradient(180deg, rgba(3, 7, 18, .15), rgba(3, 7, 18, .78)),
    radial-gradient(circle at 72% 15%, rgba(59, 130, 246, .34), transparent 25%),
    linear-gradient(180deg, #101a32 0%, #07101f 58%, #030712 100%);
}

.race-track.theme-car .lane-strip {
  height: 68px;
  border: 1px solid rgba(148, 163, 184, .2);
  background:
    linear-gradient(180deg, rgba(255,255,255,.1), transparent 13%, transparent 82%, rgba(0,0,0,.28)),
    repeating-linear-gradient(96deg, rgba(255,255,255,.025) 0 2px, transparent 2px 22px),
    linear-gradient(180deg, #4b5563 0%, #252f3f 48%, #111827 100%);
}

.race-track.theme-car .lane-strip::before {
  z-index: 1;
  height: 5px;
  background: linear-gradient(90deg, transparent 0 28px, rgba(250, 204, 21, .98) 28px 62px, transparent 62px 92px);
  animation-duration: .72s;
  box-shadow: 0 0 8px rgba(250, 204, 21, .16);
}

.race-track.theme-car .lane-strip::after {
  content: "";
  position: absolute;
  inset: 8px -140px;
  z-index: 1;
  opacity: .32;
  background:
    linear-gradient(90deg, transparent 0 44px, rgba(255,255,255,.16) 44px 47px, transparent 47px 86px),
    linear-gradient(90deg, transparent 0 64px, rgba(15,23,42,.7) 64px 67px, transparent 67px 110px);
  background-size: 86px 100%, 110px 100%;
  animation: raceRoadTexture .95s linear infinite;
  pointer-events: none;
}

.race-track.theme-car.is-racing .lane-strip::before { animation-duration: .38s; }
.race-track.theme-car.is-racing .lane-strip::after { animation-duration: .48s; opacity: .5; }

.race-car-model {
  position: relative;
  z-index: 3;
  display: block;
  width: 54px;
  height: 29px;
  filter: drop-shadow(0 5px 4px rgba(0, 0, 0, .34));
}

.race-car-model .car-body {
  position: absolute;
  left: 2px;
  right: 1px;
  bottom: 6px;
  height: 15px;
  border: 1px solid rgba(255,255,255,.34);
  border-radius: 9px 15px 6px 7px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--vehicle-color), white 28%), var(--vehicle-color) 58%, color-mix(in srgb, var(--vehicle-color), black 32%));
  box-shadow: inset 0 -4px 5px rgba(0,0,0,.2), 0 0 12px color-mix(in srgb, var(--vehicle-color), transparent 58%);
}

.race-car-model .car-cabin {
  position: absolute;
  left: 17px;
  bottom: 19px;
  width: 25px;
  height: 10px;
  border: 1px solid rgba(255,255,255,.3);
  border-bottom: 0;
  border-radius: 10px 13px 2px 2px;
  transform: skewX(14deg);
  background: color-mix(in srgb, var(--vehicle-color), black 12%);
}

.race-car-model .car-window {
  position: absolute;
  z-index: 2;
  bottom: 21px;
  height: 6px;
  background: linear-gradient(135deg, #dbeafe, #38bdf8 70%, #0f172a);
  box-shadow: inset 0 0 2px rgba(255,255,255,.8);
}

.race-car-model .car-window-rear { left: 20px; width: 9px; border-radius: 5px 1px 1px 2px; }
.race-car-model .car-window-front { left: 31px; width: 9px; border-radius: 1px 6px 2px 1px; transform: skewX(13deg); }

.race-car-model .car-wheel {
  position: absolute;
  z-index: 4;
  bottom: 1px;
  width: 11px;
  height: 11px;
  border: 3px solid #080b12;
  border-radius: 50%;
  background: radial-gradient(circle, #e2e8f0 0 18%, #475569 20% 42%, #111827 44%);
  box-shadow: 0 1px 2px rgba(0,0,0,.55);
}

.race-car-model .car-wheel-rear { left: 9px; }
.race-car-model .car-wheel-front { right: 7px; }

.race-car-model .car-headlight {
  position: absolute;
  z-index: 4;
  right: 0;
  bottom: 12px;
  width: 4px;
  height: 5px;
  border-radius: 1px 4px 4px 1px;
  background: #fef9c3;
  box-shadow: 8px 0 13px 4px rgba(254, 249, 195, .3);
}

.race-car-model .car-taillight {
  position: absolute;
  z-index: 4;
  left: 2px;
  bottom: 13px;
  width: 3px;
  height: 5px;
  border-radius: 3px 0 0 3px;
  background: #fb7185;
  box-shadow: -5px 0 9px rgba(251, 113, 133, .46);
}

.race-car-model .car-spoiler {
  position: absolute;
  z-index: 4;
  left: 2px;
  bottom: 21px;
  width: 12px;
  height: 3px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--vehicle-color), black 35%);
  box-shadow: 3px 3px 0 -1px color-mix(in srgb, var(--vehicle-color), black 35%);
}

.theme-car .lane-vehicle.moving .car-wheel { animation: raceWheelSpin .28s linear infinite; }
.theme-car .lane-vehicle.boosting .race-car-model { filter: drop-shadow(0 0 12px rgba(250,204,21,.72)) drop-shadow(0 5px 4px rgba(0,0,0,.34)); }
.race-track.theme-car .lane-vehicle > i { transform: scaleX(-1); }
.online-race-hud { grid-template-columns: minmax(160px, 1fr) auto; }

.online-lobby-car {
  width: 58px;
  height: 34px;
  overflow: visible;
}

.online-lobby-car .race-car-model {
  transform: scale(.72);
  transform-origin: center;
}

@keyframes raceRoadTexture {
  from { transform: translateX(0); }
  to { transform: translateX(-110px); }
}

@keyframes raceWheelSpin {
  to { transform: rotate(360deg); }
}

@media (max-width: 620px) {
  .race-track.theme-car { min-height: 390px; }
  .race-track.theme-car .lane-strip { height: 58px; }
  .race-car-model { width: 45px; height: 25px; transform: scale(.88); transform-origin: center; }
  .online-race-hud { grid-template-columns: 1fr; }
}

/* ================================================================
   PRACTICE RESULT MODAL — Full-Screen Overlay
   ================================================================ */

.pr-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(10, 15, 30, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: prOverlayIn 0.25s ease forwards;
}

@keyframes prOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.pr-modal-card {
  background: #fff;
  border-radius: 24px;
  padding: 40px 36px 32px;
  max-width: 760px;
  width: 100%;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(255,255,255,0.08);
  text-align: center;
  animation: prCardIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  position: relative;
  overflow: hidden;
}

.pr-modal-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #2563eb, #7c3aed, #059669);
  border-radius: 24px 24px 0 0;
}

@keyframes prCardIn {
  from { opacity: 0; transform: scale(0.80) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Hero: Trophy + Title */
.pr-modal-hero {
  margin-bottom: 28px;
}

.pr-trophy-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #fff;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(251, 191, 36, 0.40);
  animation: prTrophyBounce 0.6s cubic-bezier(0.34,1.56,0.64,1) 0.2s both;
}

@keyframes prTrophyBounce {
  from { transform: scale(0) rotate(-15deg); }
  to   { transform: scale(1) rotate(0deg); }
}

.pr-modal-hero h2 {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 6px;
}

.pr-modal-subtitle {
  font-size: 14px;
  color: #64748b;
  margin: 0;
}

/* Stats Grid */
.pr-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.pr-stat-box {
  border-radius: 16px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  overflow: hidden;
}

.pr-stat-icon {
  font-size: 20px;
  margin-bottom: 4px;
  opacity: 0.85;
}

.pr-stat-val {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}

.pr-stat-lbl {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.75;
}

/* WPM — Green */
.pr-stat-wpm {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  color: #065f46;
}
.pr-stat-wpm .pr-stat-icon { color: #059669; }

/* Accuracy — Blue */
.pr-stat-acc {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: #1e3a5f;
}
.pr-stat-acc .pr-stat-icon { color: #2563eb; }

/* Time — Orange */
.pr-stat-time {
  background: linear-gradient(135deg, #ffedd5, #fed7aa);
  color: #7c2d12;
}
.pr-stat-time .pr-stat-icon { color: #ea580c; }

/* Errors — Red */
.pr-stat-err {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #7f1d1d;
}
.pr-stat-err .pr-stat-icon { color: #dc2626; }

/* Correct Characters — Emerald */
.pr-stat-correct {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  color: #14532d;
}
.pr-stat-correct .pr-stat-icon { color: #16a34a; }

/* Wrong Characters — Rose */
.pr-stat-wrong {
  background: linear-gradient(135deg, #ffe4e6, #fecdd3);
  color: #881337;
}
.pr-stat-wrong .pr-stat-icon { color: #e11d48; }

/* Lesson Status */
.pr-stat-status {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  color: #334155;
}
.pr-stat-status .pr-stat-icon { color: #64748b; }
.pr-stat-status.pr-status-pass {
  background: linear-gradient(135deg, #d1fae5, #86efac);
  color: #064e3b;
}
.pr-stat-status.pr-status-pass .pr-stat-icon { color: #059669; }
.pr-stat-status.pr-status-practice {
  background: linear-gradient(135deg, #fef3c7, #fed7aa);
  color: #7c2d12;
}
.pr-stat-status.pr-status-practice .pr-stat-icon { color: #d97706; }

/* Minimum Target */
.pr-stat-target {
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  color: #4c1d95;
}
.pr-stat-target .pr-stat-icon { color: #7c3aed; }
.pr-stat-status .pr-stat-val,
.pr-stat-target .pr-stat-val {
  font-size: 18px;
  line-height: 1.15;
}

/* Performance Message */
.pr-performance-msg {
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 10px;
  margin-bottom: 24px;
  background: #f1f5f9;
  color: #334155;
  min-height: 0;
  transition: all 0.3s;
}

.pr-performance-msg.pr-msg-pass {
  color: #065f46;
  background: #ecfdf5;
}

.pr-performance-msg.pr-msg-practice {
  color: #92400e;
  background: #fffbeb;
}

.pr-performance-msg:empty {
  display: none;
}

/* Action Buttons */
.pr-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.pr-modal-actions .btn-outline,
.pr-modal-actions .btn-primary {
  flex: 1;
  max-width: 200px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Closing animation */
.pr-modal-overlay.pr-closing {
  animation: prOverlayOut 0.22s ease forwards;
}
.pr-modal-overlay.pr-closing .pr-modal-card {
  animation: prCardOut 0.22s ease forwards;
}

@keyframes prOverlayOut {
  to { opacity: 0; }
}
@keyframes prCardOut {
  to { opacity: 0; transform: scale(0.9) translateY(10px); }
}

/* Dark Mode */
body.dark .pr-modal-card {
  background: #1e293b;
  box-shadow: 0 24px 80px rgba(0,0,0,0.55);
}
body.dark .pr-modal-hero h2 {
  color: #f1f5f9;
}
body.dark .pr-modal-subtitle {
  color: #94a3b8;
}
body.dark .pr-performance-msg {
  background: #0f172a;
  color: #cbd5e1;
}
body.dark .pr-stat-wpm  { background: linear-gradient(135deg, #064e3b, #065f46); }
body.dark .pr-stat-acc  { background: linear-gradient(135deg, #1e3a5f, #1d4ed8aa); }
body.dark .pr-stat-time { background: linear-gradient(135deg, #431407, #7c2d12aa); }
body.dark .pr-stat-err  { background: linear-gradient(135deg, #450a0a, #7f1d1daa); }
body.dark .pr-stat-correct { background: linear-gradient(135deg, #052e1a, #166534aa); }
body.dark .pr-stat-wrong { background: linear-gradient(135deg, #4c0519, #9f1239aa); }
body.dark .pr-stat-status { background: linear-gradient(135deg, #0f172a, #334155); }
body.dark .pr-stat-status.pr-status-pass { background: linear-gradient(135deg, #064e3b, #15803d); }
body.dark .pr-stat-status.pr-status-practice { background: linear-gradient(135deg, #451a03, #92400e); }
body.dark .pr-stat-target { background: linear-gradient(135deg, #2e1065, #5b21b6aa); }
body.dark .pr-stat-wpm  .pr-stat-val { color: #6ee7b7; }
body.dark .pr-stat-acc  .pr-stat-val { color: #93c5fd; }
body.dark .pr-stat-time .pr-stat-val { color: #fdba74; }
body.dark .pr-stat-err  .pr-stat-val { color: #fca5a5; }
body.dark .pr-stat-correct .pr-stat-val { color: #86efac; }
body.dark .pr-stat-wrong .pr-stat-val { color: #fda4af; }
body.dark .pr-stat-status .pr-stat-val,
body.dark .pr-stat-target .pr-stat-val { color: #f8fafc; }
body.dark .pr-performance-msg.pr-msg-pass {
  color: #bbf7d0;
  background: #052e1a;
}
body.dark .pr-performance-msg.pr-msg-practice {
  color: #fde68a;
  background: #451a03;
}

@media (max-width: 760px) {
  .pr-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Mobile */
@media (max-width: 480px) {
  .pr-modal-card {
    padding: 28px 20px 24px;
    border-radius: 20px;
  }
  .pr-modal-hero h2 { font-size: 22px; }
  .pr-stat-val { font-size: 24px; }
  .pr-stat-status .pr-stat-val,
  .pr-stat-target .pr-stat-val { font-size: 16px; }
  .pr-modal-actions { flex-direction: column; }
  .pr-modal-actions .btn-outline,
  .pr-modal-actions .btn-primary { max-width: 100%; }
}

/* ==================== DARK MODE: TYPING FEEDBACK & LOGIN STATUS ==================== */
body.dark .typing-app-container .typing-char.current-word {
  color: #e2e8f0;
  background: rgba(96, 165, 250, 0.18);
  box-shadow: inset 0 -2px 0 rgba(96, 165, 250, 0.72);
}

body.dark .typing-app-container .typing-char.correct {
  color: #86efac;
  background: rgba(34, 197, 94, 0.22);
  box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.34);
}

body.dark .typing-app-container .typing-char.incorrect {
  color: #fecaca;
  background: rgba(244, 63, 94, 0.25);
  box-shadow: inset 0 0 0 1px rgba(251, 113, 133, 0.46);
}

body.dark .typing-app-container .typing-char.active-char {
  color: #ffffff;
  background: #6d28d9;
  box-shadow: 0 0 0 3px rgba(196, 181, 253, 0.48), 0 0 16px rgba(139, 92, 246, 0.38);
}

body.dark .typing-app-container .tp-login-banner {
  color: #dbeafe;
  background: #111827;
  border-color: #334155;
}

body.dark .typing-app-container .tp-login-banner.logged-in {
  color: #dcfce7;
  background: linear-gradient(135deg, rgba(20, 83, 45, 0.72), rgba(15, 23, 42, 0.96));
  border-color: #22c55e;
}

body.dark .typing-app-container .tp-login-banner.logged-in i {
  color: #4ade80;
}

body.dark .typing-app-container .tp-login-banner strong {
  color: #86efac;
  font-weight: 800;
}

/* ==================== SEQUENTIAL LESSON ACCESS ==================== */
.typing-app-container .lesson-card.locked {
  opacity: 0.68;
  background: #f8fafc;
  border-style: dashed;
  box-shadow: none;
}

.typing-app-container .lesson-card.locked:hover {
  transform: none;
  border-color: #cbd5e1;
  box-shadow: none;
}

.typing-app-container .lesson-status.locked {
  color: #64748b;
  background: #e2e8f0;
}

.typing-app-container .lesson-card .btn-outline:disabled {
  color: #94a3b8;
  background: #f1f5f9;
  border-color: #cbd5e1;
  cursor: not-allowed;
}

.pr-next-step {
  display: block;
  margin-top: 8px;
  color: inherit;
}

body.dark .typing-app-container .lesson-card.locked {
  background: #0f172a;
  border-color: #334155;
}

body.dark .typing-app-container .lesson-status.locked,
body.dark .typing-app-container .lesson-card .btn-outline:disabled {
  color: #94a3b8;
  background: #1e293b;
  border-color: #475569;
}

/* ==================== PAUSE / RESUME LESSON STATE ==================== */
.typing-app-container .text-display.is-paused {
  position: relative;
  overflow: hidden;
  border-color: #f59e0b;
  background: linear-gradient(135deg, #fff7ed, #ffffff);
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.18), 0 10px 28px rgba(245, 158, 11, 0.12);
}

.typing-app-container .text-display.is-paused .typing-text-wrap,
.typing-app-container .text-display.is-paused p {
  opacity: 0.42;
}

.typing-app-container .text-display.is-paused::after {
  content: "Paused - press Resume to continue";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: min(82%, 390px);
  padding: 14px 18px;
  border: 1px solid rgba(245, 158, 11, 0.38);
  border-radius: 14px;
  color: #92400e;
  background: rgba(255, 251, 235, 0.94);
  box-shadow: 0 18px 40px rgba(146, 64, 14, 0.16);
  font-family: 'Inter', 'Segoe UI', sans-serif;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-align: center;
  pointer-events: none;
}

.typing-app-container .practice-buttons #pauseBtn.is-paused {
  color: #ffffff;
  border-color: #16a34a;
  background: #16a34a;
  box-shadow: 0 10px 24px rgba(22, 163, 74, 0.22);
}

body.dark .typing-app-container .text-display.is-paused {
  border-color: #fbbf24;
  background: linear-gradient(135deg, #2a1f0b, #111827);
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.24), 0 12px 30px rgba(251, 191, 36, 0.12);
}

body.dark .typing-app-container .text-display.is-paused::after {
  color: #fef3c7;
  border-color: rgba(251, 191, 36, 0.42);
  background: rgba(30, 41, 59, 0.96);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.32);
}

body.dark .typing-app-container .practice-buttons #pauseBtn.is-paused {
  color: #ecfdf5;
  border-color: #22c55e;
  background: #15803d;
}

@media (max-width: 460px) {
  .typing-app-container .text-display.is-paused::after {
    width: min(88%, 320px);
    padding: 12px 14px;
    font-size: 12px;
  }
}

/* ==================== TYPING HIGHWAY COMPONENTS ==================== */
.highway-game-box {
  position: relative;
  width: 100%;
  height: 550px;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  font-family: 'Segoe UI', sans-serif;
  user-select: none;
}

.highway-game-box canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.highway-game-box .hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 16px 24px;
  color: #fff;
  font-weight: 700;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
  font-size: 16px;
  pointer-events: none;
  z-index: 5;
}

.highway-game-box .hud span b {
  color: #ffd34d;
}

.highway-game-box #wordBox {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 15, 30, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 16px;
  padding: 14px 34px;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 4px;
  z-index: 5;
  color: #fff;
  font-family: 'Consolas', monospace;
  transition: border-color 0.1s;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}

.highway-game-box #wordBox.err {
  border-color: #ff4d4d;
  animation: highway-shake 0.15s;
}

@keyframes highway-shake {
  25% { transform: translateX(calc(-50% - 6px)); }
  75% { transform: translateX(calc(-50% + 6px)); }
}

.highway-game-box #wordBox .done {
  color: #4ade80;
}

.highway-game-box #wordBox .now {
  color: #ffd34d;
  text-decoration: underline;
}

.highway-game-box #wordBox .rest {
  color: rgba(255, 255, 255, 0.85);
}

.highway-game-box .overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 10, 25, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 10;
  text-align: center;
  padding: 20px;
}

.highway-game-box .overlay h1 {
  font-size: 42px;
  font-weight: 800;
  background: linear-gradient(135deg, #ffd34d, #ff7847);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
  letter-spacing: 2px;
}

.highway-game-box .overlay p {
  font-size: 16px;
  opacity: 0.85;
  margin: 6px 0;
  max-width: 500px;
  line-height: 1.5;
}

.highway-game-box .overlay .stats {
  display: flex;
  gap: 20px;
  margin: 24px 0;
  flex-wrap: wrap;
  justify-content: center;
}

.highway-game-box .overlay .stat {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 16px 24px;
  border-radius: 14px;
  min-width: 110px;
  text-align: center;
  font-size: 14px;
}

.highway-game-box .overlay .stat b {
  display: block;
  font-size: 32px;
  color: #ffd34d;
  margin-bottom: 4px;
}

.highway-game-box .overlay button {
  margin-top: 10px;
  padding: 14px 44px;
  font-size: 18px;
  font-weight: 800;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: linear-gradient(135deg, #ffd34d, #ff7847);
  color: #1a1a2e;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(255, 120, 71, 0.4);
}

.highway-game-box .overlay button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(255, 120, 71, 0.6);
}

.highway-game-box #mobileInput {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.highway-game-box .hidden {
  display: none !important;
}
