/* ============================================
   TypeSkill Academy — Design System
   ============================================ */

/* --- Custom Properties --- */
:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #DBEAFE;
  --accent: #22C55E;
  --accent-dark: #16A34A;
  --success: #16A34A;
  --error: #DC2626;
  --warning: #F97316;
  --warning-dark: #EA580C;
  --text: #111827;
  --text-secondary: #4B5563;
  --text-muted: #9CA3AF;
  --bg: #F9FAFB;
  --bg-alt: #F3F4F6;
  --card: #FFFFFF;
  --border: #E5E7EB;
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.25);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 12px 48px rgba(0, 0, 0, 0.1);
  --max-width: 1200px;
  --header-height: 64px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Courier New', monospace;
  --transition: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* --- Reset --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

main:focus {
  outline: none;
}

ul, ol {
  list-style: none;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  font-weight: 600;
  color: var(--text);
}

h1 { font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 4vw, 2.25rem); letter-spacing: -0.01em; }
h3 { font-size: clamp(1.25rem, 3vw, 1.5rem); }
h4 { font-size: 1.125rem; }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 0.875rem; }

/* --- Container --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 18px;
  font-family: var(--font);
}

.logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

/* .logo-text span removed in branding update */

/* --- Navigation --- */
.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.main-nav a {
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--primary);
  background: var(--primary-light);
}

.nav-cta {
  background: var(--primary) !important;
  color: white !important;
  padding: 8px 18px !important;
  border-radius: var(--radius-sm) !important;
  font-weight: 600 !important;
}

.nav-cta:hover {
  background: var(--primary-dark) !important;
  color: white !important;
}

/* --- Mobile Menu Toggle --- */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition);
}

.menu-toggle.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.open span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* --- Footer --- */
.site-footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 48px 0 24px;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

.footer-brand p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 12px;
  max-width: 320px;
}

.footer-col h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-col a {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding: 4px 0;
}

.footer-col a:hover {
  color: var(--primary);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-social {
  display: flex;
  gap: 16px;
}

.footer-social a {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-social a:hover {
  color: var(--primary);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.25);
}

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--card);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.08);
}

.btn-accent {
  background: var(--accent);
  color: white;
}

.btn-accent:hover {
  background: var(--accent-dark);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.2);
}

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-warning:hover {
  background: var(--warning-dark);
  color: white;
}

.btn-sm {
  padding: 8px 18px;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 16px 36px;
  font-size: 1.125rem;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary.active,
.time-btn.active,
.level-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.time-btn.active:hover,
.level-btn.active:hover {
  background: var(--primary-dark);
}

/* --- Cards --- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  transition: all var(--transition);
}

.card-hover:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  border-color: transparent;
}

.card-lg {
  padding: 32px;
}

.card-sm {
  padding: 16px;
}

/* --- Hero Section --- */
.hero {
  text-align: center;
  padding: 80px 0 60px;
}

.hero h1 {
  margin-bottom: 16px;
}

.hero p {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto 32px;
}

.hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: linear-gradient(135deg, #EEF2FF, #E0F2FE);
  color: var(--primary);
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 24px;
  border: 1px solid rgba(199, 210, 254, 0.4);
}

/* --- Section --- */
.section {
  padding: 64px 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-header {
  text-align: center;
  margin-bottom: 48px;
}

.section-header h2 {
  margin-bottom: 12px;
}

.section-header p {
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto;
  font-size: 1.05rem;
}

/* --- Grid --- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
}

.grid-4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 24px;
}

/* --- Page Header (internal pages) --- */
.page-header {
  padding: 48px 0 32px;
  text-align: center;
}

.page-header h1 {
  margin-bottom: 12px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto;
}

.breadcrumb {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  padding: 10px 18px;
  background: var(--bg-card, #f8f9fa);
  border: 1px solid var(--border, #e9ecef);
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.5;
  overflow: hidden;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.breadcrumb li {
  display: flex;
  align-items: center;
  color: var(--text-muted, #6c757d);
}

.breadcrumb li + li::before {
  content: "›";
  display: inline-block;
  margin: 0 6px;
  color: var(--text-muted, #adb5bd);
  font-size: 1.1em;
  font-weight: 600;
  line-height: 1;
}

.breadcrumb a {
  color: var(--primary, #4361ee);
  text-decoration: none;
  transition: color 0.2s ease;
  padding: 2px 0;
}

.breadcrumb a:hover {
  color: var(--primary-dark, #3a56d4);
  text-decoration: underline;
}

.breadcrumb a:focus-visible {
  outline: 2px solid var(--primary, #4361ee);
  outline-offset: 2px;
  border-radius: 3px;
}

.breadcrumb [aria-current="page"] {
  color: var(--text, #212529);
  font-weight: 500;
}

@media (max-width: 480px) {
  .breadcrumb {
    padding: 8px 12px;
    font-size: 0.78rem;
    border-radius: 8px;
  }
  .breadcrumb li + li::before {
    margin: 0 4px;
  }
}

/* --- Content (for policy, educational pages) --- */
.content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px 64px;
}

.content h2 {
  margin: 40px 0 16px;
}

.content h3 {
  margin: 32px 0 12px;
}

.content p {
  margin-bottom: 16px;
  color: var(--text-secondary);
  line-height: 1.75;
}

.content ul,
.content ol {
  margin: 0 0 20px 24px;
  color: var(--text-secondary);
  line-height: 1.75;
}

.content li {
  margin-bottom: 8px;
}

.content ul li {
  list-style: disc;
}

.content ol li {
  list-style: decimal;
}

/* --- Blog --- */
.blog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
}

.blog-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all var(--transition);
}

.blog-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.blog-card-img {
  height: 180px;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 2rem;
}

.blog-card-body {
  padding: 20px;
}

.blog-card-meta {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.blog-card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.blog-card h3 a {
  color: var(--text);
}

.blog-card h3 a:hover {
  color: var(--primary);
}

.blog-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.blog-card .btn {
  font-size: 0.85rem;
  padding: 6px 16px;
}

/* --- FAQ --- */
.faq-list {
  max-width: 720px;
  margin: 0 auto;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  overflow: hidden;
}

.faq-question {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  background: var(--card);
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text);
  text-align: left;
  transition: background var(--transition);
}

.faq-question:hover {
  background: var(--bg-alt);
}

.faq-question::after {
  content: '+';
  font-size: 1.25rem;
  color: var(--text-muted);
  transition: transform var(--transition);
  flex-shrink: 0;
}

.faq-item.open .faq-question::after {
  transform: rotate(45deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow);
  padding: 0 20px;
  background: var(--card);
}

.faq-item.open .faq-answer {
  max-height: 300px;
  padding: 0 20px 18px;
}

.faq-answer p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* --- Forms --- */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--card);
  transition: border-color var(--transition);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

.form-textarea {
  min-height: 140px;
  resize: vertical;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

/* --- Tool Container (typing test, etc) --- */
.tool-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px 64px;
}

.tool-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 32px;
  margin-bottom: 24px;
}

.tool-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.tool-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.timer-display {
  font-size: 2rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--primary);
  text-align: center;
  margin-bottom: 20px;
}

.typing-area {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
  font-size: 1.1rem;
  line-height: 1.8;
  font-family: var(--font);
  margin-bottom: 16px;
  min-height: 120px;
  max-height: 200px;
  overflow-y: auto;
  position: relative;
}

.typing-area .char {
  transition: color 0.1s;
}

.typing-area .char.correct {
  color: var(--accent);
}

.typing-area .char.incorrect {
  color: #EF4444;
  background: #FEE2E2;
  border-radius: 2px;
}

.typing-area .char.current {
  border-left: 2px solid var(--primary);
  animation: blink-caret 1s step-end infinite;
}

@keyframes blink-caret {
  50% { border-color: transparent; }
}

.typing-input-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.typing-textarea {
  width: 100%;
  min-height: 120px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font-mono);
  background: var(--card);
  color: var(--text);
  resize: none;
  line-height: 1.6;
}

.typing-textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

/* --- Result Card --- */
.result-card {
  background: var(--accent);
  color: white;
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
}

.result-card h3 {
  color: white;
  margin-bottom: 20px;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-item {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.stat-number {
  font-size: 1.75rem;
  font-weight: 700;
  display: block;
}

.stat-label {
  font-size: 0.8rem;
  opacity: 0.9;
  display: block;
  margin-top: 4px;
}

/* --- Dashboard Cards --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.dashboard-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  text-align: center;
}

.dashboard-card .stat-number {
  font-size: 2.25rem;
  color: var(--primary);
}

.dashboard-card .stat-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* --- Games --- */
.game-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 20px 64px;
  text-align: center;
}

.game-canvas-wrapper {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  height: 400px;
  max-height: 70vh;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.game-input {
  width: 100%;
  padding: 14px 20px;
  font-size: 1.1rem;
  font-family: var(--font-mono);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  background: var(--card);
}

.game-input:focus {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

.game-score {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

/* --- Certificate --- */
.certificate-wrapper {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

.certificate {
  background: var(--card);
  border: 3px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 48px;
  text-align: center;
  position: relative;
}

.certificate::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  bottom: 12px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius-lg) - 8px);
  pointer-events: none;
}

.certificate h1 {
  font-size: 1.75rem;
  margin-bottom: 8px;
}

.certificate-badge {
  font-size: 3rem;
  margin: 16px 0;
}

.certificate-name {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin: 16px 0;
  padding: 8px 24px;
  border-bottom: 2px solid var(--primary);
  display: inline-block;
}

.certificate-text {
  color: var(--text-secondary);
  margin: 16px 0;
  font-size: 1rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.certificate-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

@media print {
  .site-header, .site-footer, .no-print,
  #cookie-banner, .ad-placeholder { display: none !important; }
  body { font-size: 12pt; }
  .certificate-wrapper { max-width: 100%; padding: 0; }
  .certificate { border: 2px solid #000; padding: 24px; }
  .certificate h1 { font-size: 18pt; }
  .certificate-name { font-size: 16pt; }
}

/* --- Sitemap --- */
.sitemap-list {
  columns: 3;
  column-gap: 32px;
}

.sitemap-list li {
  break-inside: avoid;
  margin-bottom: 8px;
}

.sitemap-list a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.sitemap-list a:hover {
  background: var(--primary-light);
}

/* --- 404 --- */
.error-page {
  text-align: center;
  padding: 100px 20px;
}

.error-code {
  font-size: 6rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 16px;
}

/* --- Progress Bar --- */
.progress-bar {
  height: 8px;
  background: var(--bg-alt);
  border-radius: 100px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 100px;
  transition: width 0.5s ease;
}

/* --- Featured Article --- */
.featured-article {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.featured-img {
  background: var(--bg-alt);
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 3rem;
}

.featured-body {
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.featured-body .blog-card-meta {
  margin-bottom: 12px;
}

.featured-body h2 {
  margin-bottom: 12px;
}

.featured-body p {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* --- Categories --- */
.categories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.category-tag {
  padding: 6px 14px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.category-tag:hover,
.category-tag.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* --- Ad Placeholder --- */
.ad-placeholder {
  background: var(--bg-alt);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 24px 0;
}

/* --- Lesson Roadmap --- */
.roadmap {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  max-width: 640px;
  margin: 0 auto;
}

.roadmap-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  transition: all var(--transition);
}

.roadmap-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.roadmap-step {
  width: 36px;
  height: 36px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.roadmap-content h4 {
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.roadmap-content p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* --- Daily Challenge --- */
.challenge-card {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
}

.challenge-card h3 {
  color: white;
  margin-bottom: 8px;
}

.challenge-card p {
  opacity: 0.9;
  margin-bottom: 20px;
}

.challenge-card .btn {
  background: white;
  color: var(--primary);
}

.challenge-card .btn:hover {
  background: var(--bg-alt);
}

/* --- Feature Icons --- */
.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 16px;
}

.feature-icon.blue { background: var(--primary-light); color: var(--primary); }
.feature-icon.green { background: #DCFCE7; color: var(--accent); }
.feature-icon.orange { background: #FED7AA; color: var(--warning); }

/* --- Keyboard Shortcuts --- */
.kbd {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
}

/* --- Utilities --- */
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mt-12 { margin-top: 48px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.mb-12 { margin-bottom: 48px; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.w-full { width: 100%; }
.max-w-md { max-width: 480px; }
.max-w-lg { max-width: 640px; }
.mx-auto { margin-left: auto; margin-right: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.hidden { display: none; }

/* --- Lesson Content --- */
.lesson-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  transition: all var(--transition);
}

.lesson-card:hover {
  box-shadow: var(--shadow);
}

.lesson-card h3 {
  margin-bottom: 8px;
}

.lesson-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.lesson-meta {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --- Interactive Keyboard --- */
.keyboard-layout {
  display: grid;
  gap: 4px;
  max-width: 700px;
  margin: 20px auto;
}

.key-row {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.key {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  padding: 4px;
  transition: all 0.1s;
}

.key.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: scale(0.95);
}

.key-space {
  min-width: 200px;
}

/* --- Word Display (for typing practice) --- */
.words-display {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 100px;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.word {
  font-size: 1.2rem;
  font-family: var(--font);
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.1s;
}

.word.active {
  background: var(--primary-light);
  color: var(--primary);
}

.word.done {
  color: var(--text-muted);
}

.word.correct {
  color: var(--accent);
}

.word.incorrect {
  color: #EF4444;
  background: #FEE2E2;
}

/* --- Accuracy Highlight --- */
.char-display {
  font-size: 1.5rem;
  font-family: var(--font-mono);
  letter-spacing: 2px;
  line-height: 2;
  word-break: break-all;
}

.char-correct {
  color: var(--accent);
}

.char-incorrect {
  color: #EF4444;
  background: #FEE2E2;
}

.char-pending {
  color: var(--text-muted);
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: white;
  padding: 8px 16px;
  z-index: 10000;
  transition: top 0.2s;
  font-size: 0.9rem;
  font-weight: 500;
}
.skip-link:focus {
  top: 0;
  outline: 2px solid white;
  outline-offset: 2px;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
  .blog-grid {
    grid-template-columns: 1fr 1fr;
  }
  .sitemap-list {
    columns: 2;
  }
  .featured-article {
    grid-template-columns: 1fr;
  }
  .featured-img {
    min-height: 200px;
  }
}

@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }

  .main-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 16px;
    gap: 4px;
    transform: translateY(-110%);
    opacity: 0;
    transition: all var(--transition-slow);
    z-index: 99;
    box-shadow: var(--shadow-lg);
  }

  .main-nav.open {
    transform: translateY(0);
    opacity: 1;
  }

  .main-nav a {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
  }

  .nav-cta {
    text-align: center;
    margin-top: 8px;
  }

  .hero {
    padding: 48px 0 40px;
  }

  .hero-cta {
    flex-direction: column;
    align-items: center;
  }

  .hero-cta .btn {
    width: 100%;
    max-width: 280px;
  }

  .section {
    padding: 48px 0;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .result-stats {
    grid-template-columns: 1fr 1fr;
  }

  .tool-header {
    flex-direction: column;
    align-items: stretch;
  }

  .tool-controls {
    justify-content: center;
  }

  .blog-grid {
    grid-template-columns: 1fr;
  }

  .sitemap-list {
    columns: 1;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .certificate {
    padding: 24px;
  }

  .certificate-name {
    font-size: 1.5rem;
  }

  .page-header {
    padding: 32px 0 24px;
  }

  .keyboard-layout {
    overflow-x: auto;
  }
}

@media (max-width: 480px) {
  .logo-text {
    font-size: 0.95rem;
  }
  /* .logo-text span removed in branding update */
  .result-stats {
    grid-template-columns: 1fr;
  }
  .tool-card {
    padding: 20px;
  }
  .card-lg {
    padding: 20px;
  }
}

/* ============================================
   Lesson System — Light Theme
   ============================================ */

.lesson-page {
  background: #EEF2FF;
  padding: 40px 0 80px;
  min-height: 60vh;
}

.lesson-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 32px;
  padding: 20px 24px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
}

.lesson-stats strong {
  color: var(--text);
}

.lesson-stats .progress-text {
  color: var(--text-muted);
}

.lesson-filters {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.lesson-filter-group {
  flex: 1;
  min-width: 200px;
}

.lesson-search {
  width: 100%;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font);
  transition: border-color var(--transition);
}

.lesson-search::placeholder {
  color: var(--text-muted);
}

.lesson-search:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: var(--focus-ring);
}

.lesson-select {
  width: 100%;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font);
  cursor: pointer;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.lesson-select:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: var(--focus-ring);
}

.lesson-select option {
  background: #fff;
  color: var(--text);
}

.lesson-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.lesson-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.lesson-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  border-color: transparent;
}

.lesson-card.completed {
  border-color: var(--accent);
}

.lesson-card.completed::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
}

.lesson-card.locked {
  opacity: 0.4;
  pointer-events: none;
}

.lesson-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 12px;
}

.lesson-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.lesson-badge.beginner {
  background: #DCFCE7;
  color: var(--accent-dark);
  border: 1px solid #BBF7D0;
}

.lesson-badge.intermediate {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid #BFDBFE;
}

.lesson-badge.advanced {
  background: #FED7AA;
  color: var(--warning-dark);
  border: 1px solid #FDBA74;
}

.lesson-row-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--bg-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.lesson-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.3;
}

.lesson-card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lesson-card-meta {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.lesson-card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.lesson-progress-bar {
  height: 4px;
  background: var(--bg-alt);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 16px;
}

.lesson-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.lesson-card-actions {
  display: flex;
  gap: 8px;
}

.lesson-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.3;
  white-space: nowrap;
}

.lesson-btn-primary {
  background: var(--primary);
  color: #fff;
}

.lesson-btn-primary:hover {
  background: var(--primary-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.2);
}

.lesson-btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.lesson-btn-secondary:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.lesson-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.lesson-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.lesson-empty p {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

/* --- Lesson Player --- */

.lesson-player {
  background: #EEF2FF;
  min-height: 60vh;
}

.player-header {
  text-align: center;
  margin-bottom: 24px;
}

.player-header h1 {
  color: var(--text);
  margin-bottom: 8px;
}

.player-header p {
  color: var(--text-secondary);
  font-size: 1rem;
}

.player-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.player-stat {
  text-align: center;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.player-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  display: block;
  font-family: var(--font-mono);
}

.player-stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: block;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.player-text {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  font-size: 1.25rem;
  line-height: 2;
  font-family: var(--font-mono);
  margin-bottom: 20px;
  min-height: 120px;
  max-height: 300px;
  overflow-y: auto;
  color: var(--text-muted);
  word-break: break-all;
  letter-spacing: 0.02em;
}

.player-text .char {
  transition: color 0.08s;
}

.player-text .char.correct {
  color: #047857;
  font-weight: 500;
}

.player-text .char.incorrect {
  color: #DC2626;
  background: #FEE2E2;
  border-radius: 2px;
}

.player-text .char.current {
  border-left: 2px solid var(--primary);
  animation: player-caret 1s step-end infinite;
}

.player-text .char.space {
  min-width: 0.4em;
}

@keyframes player-caret {
  50% { border-color: transparent; }
}

.player-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.player-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.player-keyboard-wrapper {
  margin-bottom: 24px;
  overflow-x: auto;
}

.player-keyboard {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  padding: 16px;
  background: #F9FAFB;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 640px;
}

@media (max-width: 700px) {
  .player-keyboard {
    min-width: 540px;
    padding: 10px;
  }
}

.pkb-row {
  display: flex;
  gap: 4px;
}

.pkb-key {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  padding: 2px 4px;
  transition: all 0.08s;
  text-transform: lowercase;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.pkb-key.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: scale(0.93);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.pkb-key.space-key {
  min-width: 160px;
}

.player-tips,
.player-instruction {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.player-tips h3,
.player-instruction h3 {
  color: var(--text);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.player-tips p,
.player-instruction p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 0;
}

.player-results {
  display: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  margin-top: 24px;
}

.player-results.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

.player-results h2 {
  color: var(--text);
  margin-bottom: 24px;
  font-size: 1.5rem;
}

.player-results .result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.player-results .stat-item {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 16px;
}

.player-results .stat-number {
  font-size: 2rem;
  color: var(--primary);
}

.player-results .stat-label {
  color: var(--text-secondary);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
  .lesson-grid {
    grid-template-columns: 1fr;
  }
  .player-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .player-results .result-stats {
    grid-template-columns: 1fr;
  }
  .player-text {
    padding: 20px;
    font-size: 1.1rem;
  }
  .lesson-filters {
    flex-direction: column;
  }
  .lesson-filter-group {
    min-width: 100%;
  }
  .lesson-stats {
    flex-direction: column;
    text-align: center;
  }
}

/* ============================================
   Premium Hero — Phase 2 Enhancement
   ============================================ */

.hero-premium {
  position: relative;
  text-align: center;
  padding: 80px 0 70px;
  overflow: hidden;
  background-image:
    radial-gradient(circle at 50% 50%, rgba(199, 210, 254, 0.1) 1px, transparent 1px),
    linear-gradient(160deg, #F8FAFC 0%, #EEF6FF 15%, #E0F2FE 35%, #CCFBF1 55%, #EDE9FE 75%, #F8FAFC 100%);
  background-size: 30px 30px, 100% 100%;
}

.hero-premium .hero-bg-shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

/* Flowing wave shapes */
.hero-waves {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.hero-wave {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.hero-wave-left {
  width: 600px;
  height: 600px;
  background: radial-gradient(ellipse at 30% 40%, rgba(139, 92, 246, 0.06) 0%, rgba(99, 102, 241, 0.03) 30%, transparent 60%);
  top: -220px;
  left: -200px;
  animation: waveFloat 18s ease-in-out infinite alternate;
}

.hero-wave-right {
  width: 520px;
  height: 520px;
  background: radial-gradient(ellipse at 60% 60%, rgba(6, 182, 212, 0.05) 0%, rgba(20, 184, 166, 0.03) 30%, transparent 60%);
  bottom: -180px;
  right: -180px;
  animation: waveFloat 15s ease-in-out infinite alternate-reverse;
}

/* Decorative background keys */
.hero-keys-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.hero-keys-bg span {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: rgba(99, 102, 241, 0.04);
  user-select: none;
  animation: keyBgFloat 20s ease-in-out infinite;
}

.hero-keys-bg span:nth-child(1) { top: 8%; left: 5%; animation-delay: 0s; }
.hero-keys-bg span:nth-child(2) { top: 15%; left: 18%; animation-delay: -2s; }
.hero-keys-bg span:nth-child(3) { top: 4%; left: 30%; animation-delay: -4s; }
.hero-keys-bg span:nth-child(4) { top: 22%; left: 10%; animation-delay: -1s; }
.hero-keys-bg span:nth-child(5) { top: 12%; right: 18%; animation-delay: -3s; }
.hero-keys-bg span:nth-child(6) { top: 5%; right: 10%; animation-delay: -5s; }
.hero-keys-bg span:nth-child(7) { top: 20%; right: 5%; animation-delay: -1.5s; }
.hero-keys-bg span:nth-child(8) { top: 10%; right: 28%; animation-delay: -3.5s; }
.hero-keys-bg span:nth-child(9) { bottom: 22%; left: 12%; animation-delay: -2.5s; }
.hero-keys-bg span:nth-child(10) { bottom: 10%; left: 25%; animation-delay: -4.5s; }
.hero-keys-bg span:nth-child(11) { bottom: 28%; left: 5%; animation-delay: -1s; }
.hero-keys-bg span:nth-child(12) { bottom: 16%; left: 18%; animation-delay: -3s; }
.hero-keys-bg span:nth-child(13) { bottom: 8%; right: 22%; animation-delay: -5s; }
.hero-keys-bg span:nth-child(14) { bottom: 25%; right: 10%; animation-delay: -2s; }
.hero-keys-bg span:nth-child(15) { bottom: 14%; right: 30%; animation-delay: -4s; }
.hero-keys-bg span:nth-child(16) { bottom: 4%; right: 16%; animation-delay: -0.5s; }

/* Glowing orbs */
.hero-premium .shape {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: orbFloat 12s ease-in-out infinite;
}

.hero-premium .shape-orb-1 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.05) 0%, transparent 60%);
  top: -120px; left: -80px;
  animation-delay: 0s;
  animation-duration: 14s;
}

.hero-premium .shape-orb-2 {
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(20, 184, 166, 0.04) 0%, transparent 60%);
  bottom: -80px; right: -60px;
  animation-delay: -3s;
  animation-duration: 16s;
}

.hero-premium .shape-orb-3 {
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.04) 0%, transparent 60%);
  top: 30%; left: 60%;
  animation-delay: -5s;
  animation-duration: 12s;
}

.hero-premium .shape-orb-4 {
  width: 150px; height: 150px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.04) 0%, transparent 60%);
  top: 55%; left: 15%;
  animation-delay: -7s;
  animation-duration: 18s;
}

/* Background animations */
@keyframes waveFloat {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(25px, -25px) scale(1.08); }
}

@keyframes keyBgFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg); opacity: 0.4; }
  50% { transform: translateY(-20px) rotate(2deg); opacity: 0.8; }
}

@keyframes orbFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  33% { transform: translateY(-12px) scale(1.04); }
  66% { transform: translateY(8px) scale(0.96); }
}

.hero-premium .container {
  position: relative;
  z-index: 1;
}

.hero-premium .floating-keys {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.hero-premium .floating-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--card);
  border: 1px solid rgba(199, 210, 254, 0.5);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04), 0 0 0 1px rgba(255,255,255,0.6);
  animation: keyFloat 3s ease-in-out infinite;
  transition: all 0.2s;
  cursor: default;
}

.hero-premium .floating-key:nth-child(2) { animation-delay: -0.2s; }
.hero-premium .floating-key:nth-child(3) { animation-delay: -0.4s; }
.hero-premium .floating-key:nth-child(4) { animation-delay: -0.6s; }
.hero-premium .floating-key:nth-child(5) { animation-delay: -0.8s; }
.hero-premium .floating-key:nth-child(6) { animation-delay: -1s; }
.hero-premium .floating-key:nth-child(7) { animation-delay: -1.2s; }
.hero-premium .floating-key:nth-child(8) { animation-delay: -1.4s; }
.hero-premium .floating-key:nth-child(9) { animation-delay: -1.6s; }
.hero-premium .floating-key:nth-child(10) { animation-delay: -1.8s; }
.hero-premium .floating-key:nth-child(11) { animation-delay: -2s; }
.hero-premium .floating-key:nth-child(12) { animation-delay: -2.2s; }

@keyframes keyFloat {
  0%, 100% { transform: translateY(0); box-shadow: 0 2px 8px rgba(0,0,0,0.04), 0 0 0 1px rgba(255,255,255,0.6); }
  50% { transform: translateY(-6px); box-shadow: 0 8px 28px rgba(37, 99, 235, 0.1), 0 2px 8px rgba(0,0,0,0.04); }
}

.hero-premium h1 {
  position: relative;
  display: inline-block;
}

.hero-premium .hero-gradient-text {
  background: linear-gradient(135deg, var(--primary), #7C3AED, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-premium .hero-subtitle {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

.hero-premium .hero-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 440px;
  margin: 32px auto 0;
}

.hero-premium .hero-mini-card {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius);
  padding: 14px 18px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  animation: fadeInUp 0.6s ease both;
  transition: all 0.3s ease;
}

.hero-premium .hero-mini-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.9);
}

.hero-premium .hero-mini-card:nth-child(2) { animation-delay: 0.2s; }

.hero-premium .mini-card-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.hero-premium .mini-card-icon.blue { background: var(--primary-light); color: var(--primary); }
.hero-premium .mini-card-icon.green { background: #DCFCE7; color: var(--accent); }

.hero-premium .mini-card-text { flex: 1; }
.hero-premium .mini-card-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.hero-premium .mini-card-value { font-size: 1.1rem; font-weight: 700; color: var(--text); }

.hero-premium .trust-micro {
  margin-top: 28px;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-premium .trust-micro span {
  display: flex;
  align-items: center;
  gap: 4px;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Button with arrow --- */
.btn-arrow::after {
  content: ' →';
  transition: transform 0.2s;
  display: inline-block;
}

.btn-arrow:hover::after {
  transform: translateX(4px);
}

/* ============================================
   CTA Above Footer — Phase 3
   ============================================ */

.cta-section {
  padding: 64px 0;
  background: linear-gradient(135deg, #EEF2FF 0%, #F0FDF4 50%, #F5F3FF 100%);
  position: relative;
  overflow: hidden;
}

.cta-section::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(37,99,235,0.06) 0%, transparent 70%);
  top: -100px; left: -100px;
  border-radius: 50%;
}

.cta-section::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(34,197,94,0.05) 0%, transparent 70%);
  bottom: -80px; right: -80px;
  border-radius: 50%;
}

.cta-section .container {
  position: relative;
  z-index: 1;
}

.cta-card {
  text-align: center;
  max-width: 640px;
  margin: 0 auto;
}

.cta-card h2 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  margin-bottom: 12px;
}

.cta-card p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 32px;
}

.cta-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.cta-actions .btn {
  min-width: 180px;
}

.cta-floating {
  position: absolute;
  font-size: 2rem;
  opacity: 0.08;
  pointer-events: none;
  animation: floatShape 6s ease-in-out infinite;
}

.cta-floating:nth-child(2) { top: 10%; left: 5%; animation-delay: -1s; }
.cta-floating:nth-child(3) { top: 15%; right: 8%; animation-delay: -2s; }
.cta-floating:nth-child(4) { bottom: 20%; left: 10%; animation-delay: -3s; }
.cta-floating:nth-child(5) { bottom: 15%; right: 5%; animation-delay: -4s; }

/* ============================================
   Dashboard Premium — Phase 10
   ============================================ */

.dashboard-welcome {
  text-align: center;
  padding: 40px 0 24px;
}

.dashboard-welcome h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin-bottom: 8px;
}

.dashboard-welcome .welcome-sub {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

.dashboard-welcome .welcome-suggestion {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 20px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 500;
}

.dashboard-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.dash-stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition: all var(--transition);
}

.dash-stat-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.dash-stat-card .dash-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 1.2rem;
}

.dash-stat-card .dash-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  display: block;
  font-family: var(--font-mono);
}

.dash-stat-card .dash-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

/* --- Badges --- */
.badges-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 100px;
  transition: all var(--transition);
}

.badge-item.earned {
  border-color: var(--accent);
  background: linear-gradient(135deg, #F0FDF4, #fff);
}

.badge-item.locked {
  opacity: 0.45;
}

.badge-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.badge-name {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  font-weight: 500;
}

/* --- Progress Section --- */
.progress-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.progress-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.progress-block h3 {
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.progress-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.progress-stat-row .label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.progress-stat-row .value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.progress-bar-lg {
  height: 10px;
  background: var(--bg-alt);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-fill-lg {
  height: 100%;
  border-radius: 100px;
  transition: width 0.8s ease;
  background: linear-gradient(90deg, var(--primary), #7C3AED);
}

/* --- Recent Activity --- */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.activity-dot.green { background: var(--accent); }
.activity-dot.blue { background: var(--primary); }
.activity-dot.orange { background: var(--warning); }

/* --- Dashboard Empty State --- */
.dash-empty {
  text-align: center;
  padding: 60px 20px;
}

.dash-empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.dash-empty h2 {
  margin-bottom: 8px;
}

.dash-empty p {
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto 24px;
}

/* --- Recommended Section --- */
.recommended-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.recommend-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
}

.recommend-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.recommend-icon {
  width: 40px; height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.recommend-text { flex: 1; }
.recommend-title { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.recommend-desc { font-size: 0.8rem; color: var(--text-muted); }

/* ============================================
   Card Animations — Phase 12
   ============================================ */

.card-lift {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.1);
  border-color: transparent;
}

.card-border-glow:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(37,99,235,0.1), 0 12px 48px rgba(0,0,0,0.08);
}

.card-fade-in {
  animation: cardFadeIn 0.5s ease both;
}

.card-fade-in:nth-child(2) { animation-delay: 0.1s; }
.card-fade-in:nth-child(3) { animation-delay: 0.2s; }
.card-fade-in:nth-child(4) { animation-delay: 0.3s; }
.card-fade-in:nth-child(5) { animation-delay: 0.4s; }
.card-fade-in:nth-child(6) { animation-delay: 0.5s; }

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.progress-pulse .progress-fill {
  animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

/* ============================================
   Blog Premium — Phase 9
   ============================================ */

.blog-hero {
  background: linear-gradient(135deg, #EEF2FF, #F5F3FF);
  padding: 48px 0;
  text-align: center;
}

.blog-search {
  max-width: 480px;
  margin: 20px auto 0;
  position: relative;
}

.blog-search input {
  width: 100%;
  padding: 14px 20px 14px 44px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.95rem;
  font-family: var(--font);
  background: var(--card);
  transition: border-color var(--transition);
}

.blog-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

.blog-search::before {
  content: '🔍';
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  z-index: 1;
}

/* ============================================
   Speed Test Premium — Phase 6
   ============================================ */

.test-timer-bar {
  height: 4px;
  background: var(--bg-alt);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 16px;
}

.test-timer-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--warning), #EF4444);
  border-radius: 4px;
  transition: width 1s linear;
}

.result-message {
  font-size: 0.95rem;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-weight: 500;
}

.result-message.excellent { background: #DCFCE7; color: #166534; }
.result-message.good { background: var(--primary-light); color: var(--primary-dark); }
.result-message.average { background: #FEF3C7; color: #92400E; }
.result-message.practice { background: #FEE2E2; color: #991B1B; }

/* ============================================
   Game: Space Jet — Phase 8
   ============================================ */

.space-game-wrapper {
  position: relative;
  width: 100%;
  max-width: 700px;
  margin: 0 auto 16px;
  background: #0B0E1A;
  border-radius: var(--radius);
  overflow: hidden;
  height: 420px;
  max-height: 70vh;
  border: 1px solid rgba(255,255,255,0.06);
}

#spaceCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #0B0E1A;
}

.game-sound-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s;
}

.game-sound-toggle:hover {
  background: rgba(255,255,255,0.2);
}

.game-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 14px 18px;
  z-index: 5;
  pointer-events: none;
}

.game-hud-item {
  color: rgba(255,255,255,0.8);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.game-hud-item strong {
  color: #fff;
  font-size: 1rem;
}

#space-lives {
  color: #EF4444;
  font-size: 1.1rem;
  letter-spacing: 2px;
}

#space-combo-display {
  color: #FBBF24;
}

#space-combo-display strong {
  color: #FBBF24;
  font-size: 1.1rem;
}

#space-wave {
  color: #60A5FA;
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(11,14,26,0.8);
  z-index: 8;
  color: #fff;
  text-align: center;
  padding: 24px;
}

.game-overlay.hidden {
  display: none;
}

.game-overlay h2 {
  color: #fff;
  font-size: 1.75rem;
  margin-bottom: 8px;
}

.game-overlay p {
  color: rgba(255,255,255,0.6);
  margin-bottom: 24px;
}

.game-overlay .btn {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 12px 32px;
  font-size: 1rem;
  transition: all 0.2s;
}

.game-overlay .btn:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

.game-difficulty {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.game-diff-btn {
  padding: 6px 16px;
  border-radius: 100px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.6);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}

.game-diff-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.game-diff-btn.active {
  background: rgba(99,102,241,0.4);
  border-color: rgba(99,102,241,0.6);
  color: #fff;
}

@media (max-width: 768px) {
  .hero-premium .hero-cards { grid-template-columns: 1fr; }
  .hero-premium .floating-key { width: 36px; height: 36px; font-size: 0.75rem; border-radius: 8px; }
  .hero-premium .hero-keys-bg span { font-size: 1rem; }
  .dashboard-grid-3 { grid-template-columns: 1fr; }
  .progress-section { grid-template-columns: 1fr; }
  .recommended-grid { grid-template-columns: 1fr; }
  .space-game-wrapper { height: 340px; }
}

@media (max-width: 480px) {
  .hero-premium { padding: 48px 0 36px; }
  .hero-premium .floating-keys { gap: 4px; }
  .hero-premium .floating-key { width: 30px; height: 30px; font-size: 0.7rem; border-radius: 6px; }
  .hero-premium .hero-keys-bg span { display: none; }
  .cta-actions { flex-direction: column; align-items: center; }
  .cta-actions .btn { width: 100%; max-width: 280px; }
  .badges-grid { justify-content: center; }
  .space-game-wrapper { height: 280px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .hero-premium .shape,
  .hero-premium .floating-key,
  .hero-premium .hero-mini-card,
  .hero-premium .hero-wave,
  .hero-premium .hero-keys-bg span,
  .cta-floating,
  .card-lift:hover,
  .card-fade-in,
  .progress-fill-lg,
  .dash-stat-card:hover {
    animation: none !important;
    transition-duration: 0.01ms !important;
    transform: none !important;
  }
  .hero-premium .hero-keys-bg span {
    opacity: 0.04;
  }
}
