/* MultiplicationChart CMS — Modern Advanced Design System */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-subtle: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-glow: rgba(79, 70, 229, 0.2);
  --primary-light: #eef2ff;
  --accent: #2563eb;
  --success: #10b981;
  --danger: #ef4444;
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --card-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --table-head-bg: #f8fafc;
  --table-row-alt: #fcfdfe;
  --table-row-hover: #eef2ff;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 9999px;
  --header-bg: rgba(255, 255, 255, 0.88);
}

[data-theme="dark"] {
  --bg-page: #0b0f19;
  --bg-surface: #111827;
  --bg-surface-elevated: #1e293b;
  --bg-subtle: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.09);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --primary-light: rgba(99, 102, 241, 0.15);
  --accent: #38bdf8;
  --card-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  --card-shadow-hover: 0 20px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(99, 102, 241, 0.18);
  --table-head-bg: #1e293b;
  --table-row-alt: #141c2e;
  --table-row-hover: #1f2d45;
  --header-bg: rgba(17, 24, 39, 0.85);
}

/* Global Reset & Base */
*, *::before, *::after { box-sizing: border-box; }
html {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}
body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color .25s ease, color .25s ease;
}
a {
  color: var(--primary);
  text-decoration: none;
  transition: color .2s ease;
}
a:hover { color: var(--primary-hover); }

.wrap {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Preview Mode Banner */
.preview-mode-bar {
  background: linear-gradient(90deg, #4f46e5, #3b82f6);
  color: #fff;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.3);
  position: relative;
  z-index: 100;
}
.preview-mode-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.preview-mode-badge {
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.preview-mode-text { flex: 1; }
.preview-mode-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.preview-btn-install {
  background: #fff;
  color: var(--primary);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: transform .15s;
}
.preview-btn-install:hover { transform: translateY(-1px); color: var(--primary-hover); }
.preview-btn-dismiss {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  opacity: 0.8;
  padding: 4px 8px;
}
.preview-btn-dismiss:hover { opacity: 1; }

/* Sticky Modern Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  transition: background-color .25s ease, border-color .25s ease;
}
.site-nav {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 800;
  font-size: 20px;
}
.brand-logo {
  height: 32px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
  vertical-align: middle;
  display: inline-block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  transition: transform .2s ease, filter .2s ease;
}
.brand:hover .brand-logo {
  transform: scale(1.03);
}
.brand-domain-tag {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid rgba(79, 70, 229, 0.2);
  align-self: center;
  transition: all .2s ease;
}
[data-theme="dark"] .brand-logo {
  /* Brighten slightly on dark backgrounds for crisp readability */
  filter: brightness(1.15) contrast(1.05);
}
[data-theme="dark"] .brand-domain-tag {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
}
.brand-logo-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 4px 12px var(--primary-glow);
}
.brand-name {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand-name span { color: var(--primary); }

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}
.site-menu {
  display: flex;
  align-items: center;
  gap: 18px;
}
.site-menu a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all .2s ease;
}
.site-menu a:hover, .site-menu a.active {
  color: var(--primary);
  background: var(--primary-light);
}

/* Nav Controls */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all .2s ease;
  font-size: 16px;
}
.icon-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
}
.theme-toggle-btn {
  position: relative;
}
[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
:root:not([data-theme="dark"]) .sun-icon { display: none; }
:root:not([data-theme="dark"]) .moon-icon { display: block; }

/* Desktop Search Slide */
.desktop-search-wrap {
  display: none;
  padding: 12px 0 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-surface);
  animation: slideDown .2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.desktop-search-wrap.is-open { display: block; }
.desktop-search-form {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 650px;
  margin: 0 auto;
}
.desktop-search-form input {
  flex: 1;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
}
.desktop-search-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Mobile Nav Drawer */
.mobile-controls { display: none; }
.mobile-menu-wrap {
  display: none;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
}
.mobile-menu-wrap.is-open { display: block; }
.mobile-menu-inner .site-menu {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.mobile-menu-inner .site-menu a {
  padding: 10px 14px;
  font-size: 15px;
  border-bottom: 1px solid var(--border-subtle);
}
.mobile-search {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.mobile-search input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-md);
}

/* Hero Section */
.hero {
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-page) 100%);
  padding: 60px 0 45px;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  margin-bottom: 16px;
  border: 1px solid rgba(99, 102, 241, 0.2);
}
.hero h1, .home-main-title {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.18;
  max-width: 880px;
  margin: 0 auto 16px;
  color: var(--text-primary);
}
.hero p, .home-lead {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 720px;
  margin: 0 auto 28px;
  line-height: 1.6;
}
.actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  background: var(--primary);
  color: #fff;
  border: 1px solid transparent;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px var(--primary-glow);
  transition: all .2s ease;
  text-decoration: none;
}
.btn:hover {
  background: var(--primary-hover);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--primary-glow);
}
.btn.light {
  background: var(--bg-surface);
  color: var(--primary);
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow);
}
.btn.light:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-hover);
}
.btn.danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.25);
}
.btn.danger:hover {
  background: #dc2626;
}

/* Table Jump & Filter Bar */
.table-jump-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  margin: 32px 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--card-shadow);
}
.jump-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.jump-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-right: 4px;
}
.jump-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.jump-btn:hover, .jump-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
}
.table-quick-search input {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: inherit;
  width: 220px;
  outline: none;
  transition: all .2s;
}
.table-quick-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Hero Headings and Short Descriptions matching Homepage Design */
.home-hero-section, .post-hero {
  text-align: center;
  margin: 12px auto 26px;
  max-width: 1140px;
  width: 100%;
}
.home-main-title, .post-title, .category-title, .page-title {
  font-size: clamp(26px, 2.7vw, 32px);
  font-weight: 800;
  line-height: 1.3;
  margin: 0 auto 14px;
  background: linear-gradient(90deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
  text-align: center;
  max-width: 1080px;
  width: 100%;
}
.home-main-title img, .post-title img, .category-title img {
  vertical-align: middle;
  margin-right: 8px;
}
[data-theme="dark"] .home-main-title,
[data-theme="dark"] .post-title,
[data-theme="dark"] .category-title,
[data-theme="dark"] .page-title {
  background: linear-gradient(90deg, #818cf8 0%, #c084fc 50%, #f472b6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.post-icon {
  width: 38px;
  height: 38px;
  object-fit: contain;
  vertical-align: middle;
}
.home-lead, .post-intro, .category-description {
  color: #475569;
  font-size: 15.5px;
  line-height: 1.65;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto 24px;
  text-align: center;
}
[data-theme="dark"] .home-lead,
[data-theme="dark"] .post-intro,
[data-theme="dark"] .category-description {
  color: #94a3b8;
}
.post-intro p, .category-description p {
  color: inherit;
  font-size: inherit;
  line-height: inherit;
  margin: 0;
  text-align: center;
}

/* Quick Navigation Pill Buttons (Image 2 style) */
.chart-pills-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 10px;
  max-width: 980px;
  margin: 18px auto 22px;
  padding: 0 4px;
}
.chart-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: #334155;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all .15s ease;
  white-space: nowrap;
}
.chart-pill-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.12);
}
.chart-pill-btn.active {
  background: #2563eb !important;
  color: #ffffff !important;
  border-color: #2563eb !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
  pointer-events: none;
}
[data-theme="dark"] .chart-pill-btn {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.14);
  color: #cbd5e1;
}
[data-theme="dark"] .chart-pill-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #3b82f6;
  color: #ffffff;
}
[data-theme="dark"] .chart-pill-btn.active {
  background: #2563eb !important;
  color: #ffffff !important;
  border-color: #2563eb !important;
}

@media(max-width: 768px) {
  .chart-pills-nav {
    gap: 7px 8px;
    margin: 14px auto 18px;
  }
  .chart-pill-btn {
    padding: 6px 12px;
    font-size: 12.5px;
  }
}

.home-print-cta {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
}
.btn-gradient-print {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  color: #ffffff !important;
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 14.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(168, 85, 247, 0.35);
  transition: transform .2s ease, box-shadow .2s ease;
  text-decoration: none;
}
.btn-gradient-print:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(168, 85, 247, 0.5);
  color: #ffffff;
}

/* Home Chart Wrap */
.home-chart-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  margin-top: 16px;
}
.home-chart-head {
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--primary);
  background: var(--bg-surface-elevated);
}
.home-chart-head strong {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}

/* Table Cards Grid */
.home-table-cards, .responsive-tables {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 40px;
}
.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.table-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(91, 82, 224, 0.12);
  border-color: rgba(91, 82, 224, 0.3);
}
.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: linear-gradient(90deg, #4f46e5 0%, #9333ea 50%, #db2777 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.table-head span {
  color: #ffffff !important;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.table-head .btn, .table-card-print-btn {
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff !important;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  box-shadow: none;
  transition: background .2s ease, transform .2s ease;
}
.table-head .btn:hover, .table-card-print-btn:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.08);
  box-shadow: none;
}

/* Table Grid */
.table-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table-grid td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.table-card .table-grid td:first-child {
  text-align: center;
  color: #2563eb;
  font-weight: 600;
  font-size: 14.5px;
  width: 55%;
  border-right: 1px solid var(--border-subtle);
}
[data-theme="dark"] .table-card .table-grid td:first-child {
  color: #60a5fa;
}
.table-card .table-grid td:last-child {
  text-align: center;
  color: #db2777;
  font-weight: 800;
  font-size: 15px;
  width: 45%;
}
[data-theme="dark"] .table-card .table-grid td:last-child {
  color: #f472b6;
}
.table-grid tr:nth-child(even) {
  background: var(--table-row-alt);
}
.table-grid tr:hover {
  background: var(--table-row-hover);
}

/* Content & Articles */
.content {
  padding: 40px 0;
  flex: 1;
}
.article, .panel, .card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--card-shadow);
}
.article h1, .article h2, .article h3 {
  color: var(--text-primary);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.article h2 {
  font-size: 26px;
  margin: 32px 0 16px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}
.article h3 { font-size: 20px; margin: 24px 0 12px; }
.article p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 16px;
}

/* Grid & Resource Cards */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.card.post-card {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all .2s ease;
}
.card.post-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: var(--card-shadow-hover);
}
.card.post-card strong {
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.4;
}
.card.post-card:hover strong {
  color: var(--primary);
}
.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: contain;
  background: var(--primary-light);
  padding: 6px;
}

/* FAQ Accordion */
.faq {
  margin-top: 36px;
}
.faq h2 {
  margin-bottom: 18px;
}
.faq details {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 10px;
  box-shadow: var(--card-shadow);
  transition: all .2s ease;
}
.faq details[open] {
  border-color: var(--primary);
  box-shadow: 0 4px 16px var(--primary-glow);
}
.faq summary {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "▾";
  font-size: 18px;
  color: var(--primary);
  transition: transform .2s;
}
.faq details[open] summary::after {
  transform: rotate(180deg);
}
.faq details div {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

/* Interactive Math Quiz & Tools Components */
.interactive-tool-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin: 20px 0;
  box-shadow: var(--card-shadow);
}
.tool-header h3 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
}
.tool-desc {
  color: var(--text-muted);
  font-size: 14px;
}
.difficulty-options {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.quiz-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.quiz-badge {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 13px;
}
.quiz-timer {
  font-weight: 800;
  font-size: 16px;
  color: #f59e0b;
}
.quiz-question-box {
  background: var(--bg-subtle);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  margin-bottom: 24px;
}
.quiz-question {
  font-size: 36px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.05em;
}
.quiz-answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.quiz-opt-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 16px;
  border-radius: var(--radius-md);
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
}
.quiz-opt-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  transform: scale(1.02);
}
.quiz-opt-btn.correct {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: #10b981 !important;
  color: #10b981 !important;
}
.quiz-opt-btn.wrong {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: #ef4444 !important;
  color: #ef4444 !important;
}
.quiz-feedback {
  margin-top: 16px;
  font-weight: 700;
  text-align: center;
  font-size: 16px;
}
.quiz-feedback.success { color: #10b981; }
.quiz-feedback.error { color: #ef4444; }

/* Table Generator Tool */
.gen-inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 14px;
  align-items: flex-end;
  margin-top: 16px;
}
.gen-inputs-grid label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.gen-inputs-grid input {
  width: 100%;
  margin-top: 6px;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-size: 14px;
}
.gen-result {
  margin-top: 24px;
}

/* Post Navigation */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 36px;
}
.post-nav-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.post-nav-item.next { text-align: right; }
.post-nav-label { font-size: 12px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; }
.post-nav-item strong { color: var(--text-primary); font-size: 15px; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 36px;
}
.page-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
}
.page-btn.active, .page-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Footer */
.site-footer {
  margin-top: auto;
  background: #0f172a;
  color: #94a3b8;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 40px 0 30px;
}
.site-footer .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.site-footer p { margin: 0; font-size: 14px; }
.site-footer .navlinks {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.site-footer .navlinks a {
  color: #cbd5e1;
  font-size: 14px;
}
.site-footer .navlinks a:hover {
  color: #fff;
}

/* Back to Top */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #fff;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px var(--primary-glow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all .25s ease;
  z-index: 99;
}
.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

/* Responsive Breakpoints */
@media(max-width: 1024px) {
  .home-table-cards, .responsive-tables, .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media(max-width: 768px) {
  .wrap { padding: 0 24px; }
  .desktop-nav { display: none; }
  .mobile-controls { display: flex; align-items: center; gap: 8px; }
  .hero h1, .home-main-title { font-size: 25px; line-height: 1.32; }
  .hero p, .home-lead { font-size: 14.5px; padding: 0 4px; }
  .home-hero-section { margin: 10px auto 24px; }
  .btn-gradient-print { width: 100%; max-width: 290px; justify-content: center; }
  .home-table-cards, .responsive-tables, .grid {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 0 4px;
  }
  .table-card {
    border-radius: 14px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
  }
  .article, .panel, .card { padding: 22px 18px; }
  .home-long-article h2 { font-size: 22px; }
  .home-long-article h3 { font-size: 18px; }
  .faq details { padding: 14px 16px; }
  .faq summary { font-size: 14.5px; }
  .gen-inputs-grid { grid-template-columns: 1fr; }
  .quiz-answers-grid { grid-template-columns: 1fr; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-item.next { text-align: left; }
  .site-footer .wrap { flex-direction: column; align-items: flex-start; }
}
@media(max-width: 480px) {
  .wrap { padding: 0 20px; }
  .home-hero-section { padding: 0 4px; }
  .home-main-title { font-size: 22px; line-height: 1.35; }
  .home-table-cards, .responsive-tables {
    padding: 0 2px;
    gap: 18px;
  }
  .table-card {
    margin: 0 auto;
    width: 100%;
    border-radius: 14px;
  }
  .table-head { padding: 11px 16px; }
  .table-head span { font-size: 15px; }
  .table-grid td { padding: 9px 12px; font-size: 13.5px; }
  .table-grid td:last-child { font-size: 14.5px; }
  .article, .panel, .card { padding: 20px 16px; }
}

/* Print Styles */
@media print {
  @page {
    size: portrait;
    margin: 4mm 5mm;
  }
  .site-header, .site-footer, .no-print, .preview-mode-bar, .back-to-top, .ad-slot, .table-jump-bar,
  .ws-hero-banner, .ws-controls-bar, .ws-score-banner, .ws-student-input, .post-title, .post-icon,
  .article, .post-article, .faq-wrap, .prev-next, .category-hero, .post-hero {
    display: none !important;
  }
  body, html {
    background: #fff !important;
    color: #000 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  main.wrap, .wrap.content, .wrap.content.post-content,
  .card.tool-output {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
  }
  .ws-container,
  .card.tool-output > .ws-card,
  .card.tool-output > div {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
  }
  .ws-printable-sheet,
  .ws-sheet-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-sizing: border-box !important;
  }
  .ws-sheet-header {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-end !important;
    border-bottom: 2px solid #000 !important;
    padding-bottom: 12px !important;
    margin-bottom: 18px !important;
    box-sizing: border-box !important;
  }
  .ws-grid,
  .ws-problems-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 16px 14px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .ws-card,
  .ws-problem-card {
    width: 100% !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
    border: 1.5px solid #64748b !important;
    border-radius: 8px !important;
    padding: 10px 12px 14px 12px !important;
    min-height: 140px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    position: relative !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .ws-card .ws-q-num,
  .ws-problem-card .ws-problem-num {
    position: static !important;
    display: inline-block !important;
    align-self: flex-start !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    background: #e2e8f0 !important;
    border: 1px solid #cbd5e1 !important;
    padding: 1px 7px !important;
    border-radius: 4px !important;
    margin: 0 0 8px 0 !important;
    line-height: 1.3 !important;
    width: fit-content !important;
    flex-shrink: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .ws-generator-root.hide-problem-nums .ws-problem-num,
  .hide-problem-nums .ws-problem-num,
  .hide-problem-nums .ws-q-num {
    display: none !important;
  }
  .ws-card .ws-math-body,
  .ws-problem-card .ws-math-display {
    font-size: 19px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    margin: auto 0 !important;
    text-align: center !important;
    width: 100% !important;
    line-height: 1.4 !important;
    box-sizing: border-box !important;
    word-break: normal !important;
  }

  /* Domino Worksheets in Print */
  .ws-domino-tile {
    display: inline-flex !important;
    background: #ffffff !important;
    border: 2px solid #000000 !important;
    border-radius: 8px !important;
    padding: 5px !important;
    box-shadow: none !important;
    margin: 0 auto 8px auto !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .ws-domino-half {
    width: 44px !important;
    height: 44px !important;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    grid-template-rows: repeat(3, 1fr) !important;
    align-items: center !important;
    justify-items: center !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .ws-domino-sep {
    width: 0 !important;
    border-left: 2px solid #000000 !important;
    background: transparent !important;
    height: 44px !important;
    margin: 0 4px !important;
    display: block !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .ws-domino-pip {
    width: 8px !important;
    height: 8px !important;
    background: #000000 !important;
    background-color: #000000 !important;
    border: 4px solid #000000 !important;
    box-sizing: border-box !important;
    border-radius: 50% !important;
    display: block !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .ws-segment-line {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 150px !important;
    margin: 6px auto 10px auto !important;
    position: relative !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .ws-segment-line::before {
    content: "" !important;
    position: absolute !important;
    left: 8px !important;
    right: 8px !important;
    height: 0 !important;
    border-top: 2px solid #000000 !important;
    background: transparent !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .ws-segment-pt {
    width: 18px !important;
    height: 18px !important;
    border-radius: 50% !important;
    background: #000000 !important;
    border: 2px solid #000000 !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    z-index: 2 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .ws-writing-space {
    display: none !important;
  }
  .ws-answer-text {
    display: none !important;
  }
  .ws-answer-key-section {
    display: none !important;
  }
  .ws-answer-key-section.print-show {
    display: block !important;
    page-break-before: always !important;
    border: 1px solid #000 !important;
    margin-top: 20px !important;
  }
  .table-card {
    break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #94a3b8 !important;
  }
  .home-table-cards, .responsive-tables {
    grid-template-columns: repeat(2, 1fr) !important;
    padding: 0 !important;
  }
  body.print-single-active * {
    visibility: hidden;
  }
  body.print-single-active .print-target-card,
  body.print-single-active .print-target-card * {
    visibility: visible;
  }
  body.print-single-active .print-target-card {
    position: absolute;
    left: 20px;
    top: 20px;
    width: 90% !important;
    max-width: 420px;
  }
}


/* Language Switcher in Header */
.lang-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 8px;
  text-decoration: none;
  transition: all .2s ease;
}
.lang-switch-btn:hover {
  background: var(--primary);
  color: #ffffff !important;
  border-color: var(--primary);
}

/* On-Page Language Toggle Badge */
.lang-page-toggle {
  display: flex;
  justify-content: center;
  margin: -10px auto 18px;
}
.lang-toggle-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: var(--primary);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  transition: all .2s ease;
}
.lang-toggle-badge:hover {
  background: var(--primary);
  color: #ffffff !important;
  border-color: var(--primary);
  transform: translateY(-1px);
}
[data-theme="dark"] .lang-toggle-badge {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
}

/* Practice Problems Card in Article */
.practice-problems-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}
.problem-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}
.problem-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.problem-item:first-child {
  padding-top: 0;
}
.problem-solution {
  color: #059669;
  font-weight: 600;
  margin-top: 4px;
}
[data-theme="dark"] .problem-solution {
  color: #34d399;
}

/* Interactive Speed Practice Drill Box */
.interactive-speed-drill {
  max-width: 680px;
  margin: 10px auto 32px;
  width: 100%;
}
.drill-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.08);
  text-align: center;
}
.drill-header {
  margin-bottom: 18px;
}
.drill-badge {
  display: inline-block;
  background: linear-gradient(135deg, #4f46e5, #9333ea);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}
.drill-header h3 {
  font-size: 20px;
  font-weight: 800;
  margin: 4px 0 6px;
  color: var(--text-primary);
}
.drill-sub {
  font-size: 13.5px;
  color: #64748b;
  margin: 0;
}
[data-theme="dark"] .drill-sub {
  color: #94a3b8;
}
.drill-stats {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 14px;
  padding: 0 4px;
}
.drill-question-box {
  background: rgba(99, 102, 241, 0.06);
  border: 2px dashed rgba(99, 102, 241, 0.3);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 18px;
}
.drill-question-box span {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.04em;
}
.drill-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.drill-opt-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 700;
  padding: 12px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all .15s ease;
}
.drill-opt-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
  transform: translateY(-2px);
}
.drill-opt-btn.correct {
  background: #10b981 !important;
  color: #ffffff !important;
  border-color: #10b981 !important;
}
.drill-opt-btn.wrong {
  background: #ef4444 !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
}
.drill-feedback {
  font-size: 14px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 8px;
  margin-top: 8px;
}
.drill-feedback.success {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}
.drill-feedback.error {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}
.drill-done-box {
  padding: 16px;
  background: rgba(99, 102, 241, 0.06);
  border-radius: 12px;
  margin-top: 10px;
}
.drill-done-box h4 {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 6px;
}
.drill-done-box p {
  font-size: 14px;
  margin-bottom: 14px;
}

@media(max-width: 480px) {
  .interactive-speed-drill {
    padding: 0 4px;
  }
  .drill-card {
    padding: 18px 14px;
  }
  .drill-question-box span {
    font-size: 24px;
  }
  .drill-opt-btn {
    padding: 10px 12px;
    font-size: 16px;
  }
}

/* Times Tables 1-100 Quick Switcher Card & Buttons Grid */
.times-switcher-card {
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 16px;
  padding: 16px 20px;
  margin: 16px auto 22px;
  max-width: 980px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}
.times-switcher-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}
.times-range-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
}
.times-range-tab {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 20px;
  background: var(--bg-card, #f1f5f9);
  color: var(--text-primary, #475569);
  text-decoration: none;
  border: 1px solid var(--border-color, #cbd5e1);
  transition: all .15s ease;
}
.times-range-tab:hover {
  background: #e2e8f0;
  color: #1e293b;
}
.times-range-tab.active {
  background: #4f46e5;
  color: #ffffff;
  border-color: #4f46e5;
}
[data-theme="dark"] .times-range-tab {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: #cbd5e1;
}
[data-theme="dark"] .times-range-tab.active {
  background: #6366f1;
  color: #ffffff;
}
.times-switcher-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--text-primary, #1e293b);
}
.times-switcher-icon {
  font-size: 18px;
}
.times-switcher-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(79, 70, 229, 0.1);
  color: #4f46e5;
}
.times-switcher-search {
  display: flex;
  align-items: center;
  gap: 6px;
}
.times-switcher-search input {
  width: 130px;
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 8px;
  background: var(--bg-card, #f8fafc);
  color: var(--text-primary, #0f172a);
}
.times-switcher-search input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}
.times-jump-btn {
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
.times-buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
  scrollbar-width: thin;
}
.times-num-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #334155);
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 8px;
  text-decoration: none;
  transition: all .15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.times-num-btn:hover {
  border-color: #4f46e5;
  color: #4f46e5;
  background: #f1f5f9;
  transform: translateY(-1px);
}
.times-num-btn.active {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%) !important;
  color: #ffffff !important;
  border-color: #4f46e5 !important;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
  pointer-events: none;
}
[data-theme="dark"] .times-switcher-card {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .times-switcher-header {
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .times-switcher-badge {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}
[data-theme="dark"] .times-switcher-search input {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.14);
  color: #f1f5f9;
}
[data-theme="dark"] .times-num-btn {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
}
[data-theme="dark"] .times-num-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: #818cf8;
  color: #ffffff;
}
@media (max-width: 640px) {
  .times-switcher-card {
    padding: 12px 14px;
    margin: 12px auto 18px;
  }
  .times-switcher-header {
    flex-direction: column;
    align-items: stretch;
  }
  .times-switcher-search {
    width: 100%;
  }
  .times-switcher-search input {
    flex: 1;
    width: auto;
  }
  .times-buttons-grid {
    grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
    gap: 5px;
    max-height: 200px;
  }
  .times-num-btn {
    height: 32px;
    font-size: 12px;
  }
}

/* ==========================================================================
   Speed Test Game Suite — Modern Interactive UI
   ========================================================================== */
.speed-game-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 32px 24px;
  margin: 16px auto 32px;
  max-width: 100%;
  width: 100%;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.07), 0 0 0 1px rgba(79, 70, 229, 0.06);
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}
[data-theme="dark"] .speed-game-card {
  background: #131b2e;
  border-color: rgba(99, 102, 241, 0.25);
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.5), 0 0 25px rgba(99, 102, 241, 0.15);
}
.speed-game-header {
  margin-bottom: 24px;
}
.speed-game-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.speed-game-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}
.speed-game-sub {
  font-size: 15px;
  color: var(--text-muted);
  margin: 0;
  font-weight: 500;
}
.speed-section-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin: 18px 0 10px;
}
.speed-pills-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}
.speed-pill-btn {
  background: #fff5e6;
  border: 1.5px solid #fcd34d;
  color: #92400e;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.1);
}
.speed-pill-btn:hover {
  background: #fef3c7;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(245, 158, 11, 0.2);
}
.speed-pill-btn.active {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  border-color: #d97706;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
  transform: scale(1.04);
}
[data-theme="dark"] .speed-pill-btn {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fde68a;
}
[data-theme="dark"] .speed-pill-btn.active {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  border-color: #f59e0b;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.5);
}
.speed-start-cta {
  margin: 24px 0 16px;
}
.speed-btn-start {
  background: linear-gradient(135deg, #ff416c, #ff4b2b);
  border: none;
  color: #ffffff;
  font-family: inherit;
  font-size: 18px;
  font-weight: 800;
  padding: 14px 38px;
  border-radius: 9999px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 65, 108, 0.4);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.speed-btn-start:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 25px rgba(255, 65, 108, 0.5);
}
.speed-btn-start:active {
  transform: translateY(1px);
}

/* Play Screen */
.speed-play-screen {
  animation: fadeIn 0.3s ease;
}
.speed-timer-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--bg-subtle);
  border-radius: 9999px;
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}
.speed-timer-bar {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #f59e0b, #ef4444);
  width: 100%;
  transition: width 0.2s linear;
}
.speed-stats-grid {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(12px, 3vw, 24px);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.speed-stat-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  padding: 6px 16px;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.speed-streak-badge {
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff;
  border: none;
  animation: pulse 1s infinite alternate;
}
.speed-q-card {
  background: var(--bg-subtle);
  border: 2px solid var(--border-color);
  border-radius: 20px;
  padding: 24px 16px;
  margin: 0 auto 20px;
  max-width: 520px;
  transition: border-color 0.2s ease;
}
.speed-q-text {
  font-size: clamp(34px, 7vw, 48px);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.04em;
  margin: 0 0 16px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.speed-input-wrap {
  display: flex;
  justify-content: center;
  gap: 10px;
  max-width: 400px;
  margin: 0 auto;
}
.speed-answer-input {
  width: 160px;
  height: 54px;
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  border-radius: 14px;
  border: 2.5px solid var(--primary);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
  transition: all 0.2s ease;
}
.speed-answer-input:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.25);
}
.speed-btn-submit {
  background: linear-gradient(135deg, #10b981, #059669);
  border: none;
  color: #ffffff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 0 22px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transition: transform 0.15s ease;
  white-space: nowrap;
}
.speed-btn-submit:hover {
  transform: translateY(-2px);
}
.speed-btn-skip {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 0 14px;
  border-radius: 14px;
  cursor: pointer;
}
.speed-feedback {
  min-height: 32px;
  margin: 12px 0 4px;
  font-size: 16px;
  font-weight: 700;
}
.speed-feedback.correct {
  color: #10b981;
}
.speed-feedback.wrong {
  color: #ef4444;
}

/* On-Screen Mobile Numpad */
.speed-numpad-toggle {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin: 12px auto 6px;
  display: inline-block;
  text-decoration: underline;
}
.speed-numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 240px;
  margin: 10px auto 0;
}
.speed-num-key {
  height: 48px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.1s ease;
}
.speed-num-key:active {
  transform: scale(0.94);
  background: var(--primary-light);
}

/* Results Screen */
.speed-result-card {
  padding: 20px 0;
  animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.speed-result-emoji {
  font-size: 56px;
  margin-bottom: 10px;
}
.speed-result-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 8px;
}
.speed-result-badge {
  display: inline-block;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  padding: 6px 18px;
  border-radius: 9999px;
  margin-bottom: 20px;
}
.speed-result-stats-table {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  max-width: 500px;
  margin: 0 auto 24px;
}
.speed-result-stat-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 14px 10px;
}
.speed-result-stat-val {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}
.speed-result-stat-lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}
.speed-result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
@media (max-width: 480px) {
  .speed-game-card {
    padding: 22px 14px;
    border-radius: 18px;
  }
  .speed-pill-btn {
    font-size: 12.5px;
    padding: 7px 12px;
  }
  .speed-input-wrap {
    flex-wrap: wrap;
  }
  .speed-answer-input {
    width: 130px;
    height: 48px;
    font-size: 24px;
  }
  .speed-btn-submit {
    padding: 0 16px;
    height: 48px;
  }
}

.card.tool-output {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin-bottom: 45px !important;
  width: 100% !important;
}

/* ==========================================================================
   Math & Division Worksheet Tools: Full Width, Center Aligned & Clear Spacing
   ========================================================================== */
.card.tool-output > .ws-container,
.card.tool-output > .ws-card {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto 40px auto !important;
  box-sizing: border-box !important;
}

.ws-container .ws-hero-banner,
.ws-card .ws-hero-banner {
  text-align: center !important;
  align-items: center !important;
  justify-content: center !important;
  display: flex !important;
  flex-direction: column !important;
}

.ws-container .ws-badge,
.ws-card .ws-badge {
  align-self: center !important;
  margin: 0 auto 6px auto !important;
  text-align: center !important;
}

.ws-container .ws-title,
.ws-card .ws-title {
  text-align: center !important;
  width: 100% !important;
  margin: 0 auto 6px auto !important;
}

.ws-container .ws-subtitle,
.ws-card .ws-subtitle {
  text-align: center !important;
  max-width: 720px !important;
  margin: 0 auto !important;
}

.ws-container .ws-settings-row,
.ws-card .ws-settings-row,
.ws-container .ws-actions-row,
.ws-card .ws-actions-row {
  justify-content: center !important;
  align-items: center !important;
  text-align: center !important;
  display: flex !important;
}

.ws-container .ws-grid,
.ws-card .ws-problems-grid {
  width: 100% !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 24px 20px !important;
}

@media screen and (max-width: 860px) {
  .ws-container .ws-grid,
  .ws-card .ws-problems-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media screen and (max-width: 540px) {
  .ws-container .ws-grid,
  .ws-card .ws-problems-grid {
    grid-template-columns: 1fr !important;
  }
}


/* ==========================================================================
   Quiz & Game Tool Cards: Full-Width Expansion & Header Center-Alignment
   ========================================================================== */
.speed-game-card,
.quiz-panel,
.qgen-panel,
.g1-panel,
.g2-panel,
.g3-panel,
.g4-panel,
.g5-panel,
.arcade-panel,
.sc-panel,
.q12-panel,
.add1-panel,
.add2-panel,
.add3-panel,
.add4-panel,
.add5-panel,
.add-kids-panel,
.add-k-panel,
.add-game-panel,
.rep-add-panel,
.add-2d-panel,
.add-3d-panel,
.add-hard-panel,
.add-adult-panel {
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Center-align Quiz Tool Header Elements (Badge/Pill, Title, Subtitle) */
.quiz-tool-header,
.qgen-header-wrap {
  text-align: center !important;
  margin-bottom: 24px !important;
}

.quiz-header-badge,
.qgen-pill,
.g1-badge,
.g2-badge,
.g3-badge,
.g4-badge,
.g5-badge,
.arcade-header-badge,
.sc-badge,
.q12-badge,
.add1-badge,
.add2-badge,
.add3-badge,
.add4-badge,
.add5-badge,
.add-kids-badge,
.add-k-badge,
.add-game-badge,
.rep-badge,
.add-2d-badge,
.add-3d-badge,
.add-hard-badge,
.add-adult-badge {
  display: table !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-bottom: 12px !important;
  text-align: center !important;
}

.quiz-title-big,
.qgen-heading,
.g1-title,
.g2-title,
.g3-title,
.g4-title,
.g5-title,
.arcade-title,
.sc-title,
.q12-title,
.add1-title,
.add2-title,
.add3-title,
.add4-title,
.add5-title,
.add-kids-title,
.add-k-title,
.add-game-title,
.rep-title,
.add-2d-title,
.add-3d-title,
.add-hard-title,
.add-adult-title {
  text-align: center !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-top: 0 !important;
  margin-bottom: 8px !important;
}

.quiz-desc-sub,
.qgen-sub,
.g1-sub,
.g2-sub,
.g3-sub,
.g4-sub,
.g5-sub,
.arcade-sub,
.sc-sub,
.q12-sub,
.add1-sub,
.add2-sub,
.add3-sub,
.add4-sub,
.add5-sub,
.add-kids-sub,
.add-k-sub,
.add-game-sub,
.rep-sub,
.add-2d-sub,
.add-3d-sub,
.add-hard-sub,
.add-adult-sub {
  text-align: center !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-top: 0 !important;
  margin-bottom: 24px !important;
  max-width: 820px !important;
}

/* ==========================================================================
   Division & Mixed Quiz Tool Cards: Full-Width Expansion & Header Center-Alignment
   ========================================================================== */
.div-game-panel,
.ldiv-panel,
.nfl-panel,
.cell-panel,
.md1-panel,
.md2-panel,
.md3-panel,
.md4-panel,
.md5-panel,
.md6-panel,
.mit-panel,
.dec-div-panel,
.poly-div-panel,
.frac-div-panel,
.ldiv-online-panel,
.div1-panel,
.div2-panel,
.div3-panel,
.div4-panel,
.div5-panel,
.div6-panel,
.hard-div-panel,
.cell7-panel,
.frac-md-panel,
.md-universal-panel {
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Generic Header Centering for All Quiz Tool Headers */
.quiz-tool-header,
.quiz-tool-header-center {
  text-align: center !important;
  margin-bottom: 24px !important;
}

.quiz-tool-header > *,
.quiz-tool-header-center > * {
  margin-left: auto !important;
  margin-right: auto !important;
  text-align: center !important;
}

.div-game-badge,
.ldiv-badge,
.nfl-badge,
.cell-badge,
.md1-badge,
.md2-badge,
.md3-badge,
.md4-badge,
.md5-badge,
.md6-badge,
.mit-badge,
.dec-div-badge,
.poly-div-badge,
.frac-div-badge,
.ldiv-online-badge,
.div1-badge,
.div2-badge,
.div3-badge,
.div4-badge,
.div5-badge,
.div6-badge,
.hard-div-badge,
.cell7-badge,
.frac-md-badge,
.md-universal-badge {
  display: table !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-bottom: 12px !important;
  text-align: center !important;
}

.div-game-title,
.ldiv-title,
.nfl-title,
.cell-title,
.md1-title,
.md2-title,
.md3-title,
.md4-title,
.md5-title,
.md6-title,
.mit-title,
.dec-div-title,
.poly-div-title,
.frac-div-title,
.ldiv-online-title,
.div1-title,
.div2-title,
.div3-title,
.div4-title,
.div5-title,
.div6-title,
.hard-div-title,
.cell7-title,
.frac-md-title,
.md-universal-title {
  text-align: center !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-top: 0 !important;
  margin-bottom: 8px !important;
}

.div-game-sub,
.ldiv-sub,
.nfl-sub,
.cell-sub,
.md1-sub,
.md2-sub,
.md3-sub,
.md4-sub,
.md5-sub,
.md6-sub,
.mit-sub,
.dec-div-sub,
.poly-div-sub,
.frac-div-sub,
.ldiv-online-sub,
.div1-sub,
.div2-sub,
.div3-sub,
.div4-sub,
.div5-sub,
.div6-sub,
.hard-div-sub,
.cell7-sub,
.frac-md-sub,
.md-universal-sub {
  text-align: center !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-top: 0 !important;
  margin-bottom: 24px !important;
  max-width: 820px !important;
}

/* ==========================================================================
   Subtraction & Mixed Quad Operations Quiz Tool Cards: Full-Width & Centered
   ========================================================================== */
.as-panel,
.sub1-panel,
.sub2-panel,
.sub3-panel,
.sub4-panel,
.sub5-panel,
.as1-panel,
.as2-panel,
.as3-panel,
.as4-panel,
.as5-panel,
.bin-panel,
.frac-sub-panel,
.sub-k-panel,
.sub-game-panel,
.all4-panel {
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.as-badge,
.sub1-badge,
.sub2-badge,
.sub3-badge,
.sub4-badge,
.sub5-badge,
.as1-badge,
.as2-badge,
.as3-badge,
.as4-badge,
.as5-badge,
.bin-badge,
.frac-sub-badge,
.sub-k-badge,
.sub-game-badge,
.all4-badge {
  display: table !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-bottom: 12px !important;
  text-align: center !important;
}

.as-title,
.sub1-title,
.sub2-title,
.sub3-title,
.sub4-title,
.sub5-title,
.as1-title,
.as2-title,
.as3-title,
.as4-title,
.as5-title,
.bin-title,
.frac-sub-title,
.sub-k-title,
.sub-game-title,
.all4-title {
  text-align: center !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-top: 0 !important;
  margin-bottom: 8px !important;
}

.as-sub,
.sub1-sub,
.sub2-sub,
.sub3-sub,
.sub4-sub,
.sub5-sub,
.as1-sub,
.as2-sub,
.as3-sub,
.as4-sub,
.as5-sub,
.bin-sub,
.frac-sub-sub,
.sub-k-sub,
.sub-game-sub,
.all4-sub {
  text-align: center !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-top: 0 !important;
  margin-bottom: 24px !important;
  max-width: 820px !important;
}

/* ==========================================================================
   /* Universal Article & Post Table Universal Theme Support */
   ========================================================================== */
.article table,
.post-article table,
.content table {
  width: 100% !important;
  min-width: 100%;
  border-collapse: collapse !important;
  margin: 0 !important;
  font-size: 14.5px !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  overflow: visible !important;
}

.article thead tr,
.post-article thead tr,
.content thead tr {
  background: var(--primary-light, #eef2ff) !important;
  color: var(--primary, #4f46e5) !important;
  text-align: left !important;
}

[data-theme="dark"] .article thead tr,
[data-theme="dark"] .post-article thead tr,
[data-theme="dark"] .content thead tr {
  background: #1e293b !important;
  color: #38bdf8 !important;
}

.article th,
.post-article th,
.content th {
  padding: 12px 16px !important;
  font-weight: 700 !important;
  font-size: 14.5px !important;
  color: inherit !important;
  border: 1px solid var(--border-color) !important;
  text-align: left !important;
}

[data-theme="dark"] .article th,
[data-theme="dark"] .post-article th,
[data-theme="dark"] .content th {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.article td,
.post-article td,
.content td {
  padding: 12px 16px !important;
  font-size: 14.5px !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
  line-height: 1.55 !important;
}

[data-theme="dark"] .article td,
[data-theme="dark"] .post-article td,
[data-theme="dark"] .content td {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Light Theme: Override harsh dark backgrounds on rows/cells */
:root:not([data-theme="dark"]) .article tbody tr,
:root:not([data-theme="dark"]) .post-article tbody tr,
:root:not([data-theme="dark"]) .content tbody tr {
  background: #ffffff !important;
  color: var(--text-primary, #0f172a) !important;
}

:root:not([data-theme="dark"]) .article tbody tr:nth-child(even),
:root:not([data-theme="dark"]) .post-article tbody tr:nth-child(even),
:root:not([data-theme="dark"]) .content tbody tr:nth-child(even) {
  background: #f8fafc !important;
}

:root:not([data-theme="dark"]) .article tbody tr:hover,
:root:not([data-theme="dark"]) .post-article tbody tr:hover,
:root:not([data-theme="dark"]) .content tbody tr:hover {
  background: #f1f5f9 !important;
}

/* Preserve specific colored badge cells (like AFC red, NFC blue) */
.article td[style*="color:#ef4444"],
.post-article td[style*="color:#ef4444"],
.content td[style*="color:#ef4444"] {
  color: #ef4444 !important;
}

.article td[style*="color:#3b82f6"],
.post-article td[style*="color:#3b82f6"],
.content td[style*="color:#3b82f6"] {
  color: #2563eb !important;
}

[data-theme="dark"] .article td[style*="color:#3b82f6"],
[data-theme="dark"] .post-article td[style*="color:#3b82f6"],
[data-theme="dark"] .content td[style*="color:#3b82f6"] {
  color: #60a5fa !important;
}

/* Dark Theme: Consistent sleek dark zebra striping */
[data-theme="dark"] .article tbody tr,
[data-theme="dark"] .post-article tbody tr,
[data-theme="dark"] .content tbody tr {
  background: var(--bg-surface, #111827) !important;
  color: var(--text-primary, #f8fafc) !important;
}

[data-theme="dark"] .article tbody tr:nth-child(even),
[data-theme="dark"] .post-article tbody tr:nth-child(even),
[data-theme="dark"] .content tbody tr:nth-child(even) {
  background: #151e2e !important;
}

[data-theme="dark"] .article tbody tr:hover,
[data-theme="dark"] .post-article tbody tr:hover,
[data-theme="dark"] .content tbody tr:hover {
  background: #1e293b !important;
}

/* ==========================================================================
   MODERN ADVANCED SEARCH ENGINE STYLES
   ========================================================================== */

/* Search Page Layout */
.search-page-main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* Hero Search Container */
.search-hero {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 44px 36px 36px;
  box-shadow: 0 12px 36px -10px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(79, 70, 229, 0.04);
  text-align: center;
  margin-bottom: 36px;
  position: relative;
  overflow: hidden;
  transition: all .25s ease;
}

[data-theme="dark"] .search-hero {
  background: var(--bg-surface);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.45), 0 0 25px rgba(99, 102, 241, 0.12);
}

.search-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  margin-bottom: 14px;
  border: 1px solid rgba(79, 70, 229, 0.18);
}

.search-hero-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin: 0 0 12px;
  line-height: 1.22;
}

[data-theme="dark"] .search-hero-title {
  background: linear-gradient(135deg, #818cf8 0%, #c084fc 50%, #f472b6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.search-hero-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 660px;
  margin: 0 auto 28px;
  line-height: 1.6;
}

/* Search Bar Input Wrapper */
.search-hero-form {
  max-width: 740px;
  margin: 0 auto;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-page);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  padding: 6px 8px 6px 18px;
  transition: all .25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
  position: relative;
}

.search-input-wrapper:focus-within {
  border-color: var(--primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 4px var(--primary-glow), 0 8px 24px -6px rgba(79, 70, 229, 0.2);
}

.search-icon-svg {
  color: var(--primary);
  flex-shrink: 0;
  margin-right: 12px;
}

.search-hero-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 16.5px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  padding: 10px 4px;
}

.search-hero-input::-webkit-search-cancel-button {
  display: none;
}

.search-clear-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: none;
  place-items: center;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  margin-right: 10px;
  transition: all .2s ease;
  line-height: 1;
}

.search-clear-btn.is-visible {
  display: grid;
}

.search-clear-btn:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  transform: scale(1.08);
}

.btn-search-submit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  padding: 12px 24px;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--primary-glow);
  transition: all .22s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.btn-search-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px var(--primary-glow);
  filter: brightness(1.05);
}

/* Quick Search Chip Pills */
.search-quick-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 10px;
  margin-top: 24px;
}

.chips-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 4px;
}

.quick-chip {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 6px 14px;
  cursor: pointer;
  transition: all .18s ease;
  font-family: inherit;
}

.quick-chip:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* Category Filter Bar */
.search-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-color);
}

.search-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.filter-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 7px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .18s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.filter-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg-subtle);
  transform: translateY(-1px);
}

.filter-pill.active {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px var(--primary-glow) !important;
}

.filter-pill .pill-count {
  font-size: 11px;
  font-weight: 700;
  background: var(--bg-subtle);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  transition: all .18s ease;
}

.filter-pill.active .pill-count {
  background: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

.search-meta-summary {
  font-size: 14.5px;
  color: var(--text-secondary);
}

.search-meta-summary strong {
  color: var(--text-primary);
  font-weight: 700;
}

/* Results Cards List */
.search-cards-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.search-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px 24px;
  text-decoration: none;
  transition: all .22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  box-shadow: var(--card-shadow);
}

.search-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: var(--card-shadow-hover);
}

.search-card-icon-box {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 24px;
  flex-shrink: 0;
  transition: transform .2s ease;
}

.search-card:hover .search-card-icon-box {
  transform: scale(1.08);
}

.search-card-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.search-card-body {
  flex: 1;
  min-width: 0;
}

.search-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.search-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 6px;
}

/* Category Badge Color Tokens */
.badge-emerald {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
[data-theme="dark"] .badge-emerald {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

.badge-sky {
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
  border: 1px solid rgba(2, 132, 199, 0.25);
}
[data-theme="dark"] .badge-sky {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.4);
}

.badge-purple {
  background: rgba(147, 51, 234, 0.12);
  color: #9333ea;
  border: 1px solid rgba(147, 51, 234, 0.25);
}
[data-theme="dark"] .badge-purple {
  background: rgba(192, 132, 252, 0.2);
  color: #c084fc;
  border-color: rgba(192, 132, 252, 0.4);
}

.badge-indigo {
  background: rgba(79, 70, 229, 0.12);
  color: #4f46e5;
  border: 1px solid rgba(79, 70, 229, 0.25);
}
[data-theme="dark"] .badge-indigo {
  background: rgba(129, 140, 248, 0.2);
  color: #818cf8;
  border-color: rgba(129, 140, 248, 0.4);
}

.badge-rose {
  background: rgba(225, 29, 72, 0.12);
  color: #e11d48;
  border: 1px solid rgba(225, 29, 72, 0.25);
}
[data-theme="dark"] .badge-rose {
  background: rgba(244, 63, 94, 0.2);
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.4);
}

.badge-amber {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
  border: 1px solid rgba(217, 119, 6, 0.25);
}
[data-theme="dark"] .badge-amber {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}

.badge-teal {
  background: rgba(13, 148, 136, 0.12);
  color: #0d9488;
  border: 1px solid rgba(13, 148, 136, 0.25);
}
[data-theme="dark"] .badge-teal {
  background: rgba(45, 212, 191, 0.2);
  color: #2dd4bf;
  border-color: rgba(45, 212, 191, 0.4);
}

.badge-slate {
  background: rgba(71, 85, 105, 0.12);
  color: #475569;
  border: 1px solid rgba(71, 85, 105, 0.25);
}
[data-theme="dark"] .badge-slate {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.4);
}

.badge-gray {
  background: rgba(100, 116, 139, 0.12);
  color: #64748b;
  border: 1px solid rgba(100, 116, 139, 0.25);
}
[data-theme="dark"] .badge-gray {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.3);
}

.search-card-title {
  font-size: 17.5px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  margin: 0 0 6px;
  transition: color .2s ease;
}

.search-card:hover .search-card-title {
  color: var(--primary);
}

.search-card-excerpt {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-card-action {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  padding-left: 12px;
}

.action-arrow {
  transition: transform .2s ease;
  font-size: 16px;
}

.search-card:hover .action-arrow {
  transform: translateX(5px);
}

/* Matching Keyword Highlight */
.search-highlight {
  background: #fef08a;
  color: #854d0e;
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 700;
}

[data-theme="dark"] .search-highlight {
  background: rgba(234, 179, 8, 0.28);
  color: #fde047;
  border: 1px solid rgba(234, 179, 8, 0.45);
}

/* Zero Results State */
.search-zero-state {
  text-align: center;
  padding: 56px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: var(--card-shadow);
}

.search-zero-icon {
  font-size: 52px;
  margin-bottom: 18px;
  animation: pulseIcon 2s infinite ease-in-out;
}

@keyframes pulseIcon {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.search-zero-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 10px;
}

.search-zero-text {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto 28px;
  line-height: 1.6;
}

.search-zero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Empty Hub: Browse by Category */
.search-empty-hub {
  margin-top: 40px;
}

.search-hub-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 20px;
  text-align: center;
  letter-spacing: -0.02em;
}

.search-categories-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.search-cat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  text-decoration: none;
  transition: all .22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--card-shadow);
}

.search-cat-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: var(--card-shadow-hover);
}

.cat-icon-badge {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--primary-light);
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}

.cat-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cat-card-body strong {
  font-size: 15.5px;
  color: var(--text-primary);
  font-weight: 700;
  transition: color .2s;
}

.search-cat-card:hover .cat-card-body strong {
  color: var(--primary);
}

.cat-card-body span {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.cat-card-arrow {
  font-size: 18px;
  color: var(--text-muted);
  transition: all .2s ease;
}

.search-cat-card:hover .cat-card-arrow {
  color: var(--primary);
  transform: translateX(4px);
}

/* Header Live Dropdown Autocomplete */
.header-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.desktop-search-form, .mobile-search {
  position: relative;
}

.search-live-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 18px 40px -10px rgba(0, 0, 0, 0.2), 0 0 0 1px var(--border-color);
  z-index: 1000;
  overflow: hidden;
  display: none;
  animation: dropdownFade .18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownFade {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-live-dropdown.is-active {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  text-decoration: none;
  transition: background .15s ease;
  color: var(--text-primary);
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover, .dropdown-item.is-selected {
  background: var(--primary-light);
}

.dropdown-item-icon {
  font-size: 18px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--bg-subtle);
  flex-shrink: 0;
}

.dropdown-item-body {
  flex: 1;
  min-width: 0;
}

.dropdown-item-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.dropdown-item-badge {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 6px;
}

.dropdown-footer {
  display: block;
  padding: 11px 16px;
  text-align: center;
  font-size: 13.5px;
  font-weight: 700;
  background: var(--bg-subtle);
  color: var(--primary);
  text-decoration: none;
  transition: background .15s ease;
}

.dropdown-footer:hover {
  background: var(--primary-light);
}

/* Responsive Search Design */
@media (max-width: 900px) {
  .search-categories-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .search-page-main {
    padding: 24px 16px 60px;
  }
  .search-hero {
    padding: 28px 20px 24px;
    border-radius: 18px;
  }
  .search-hero-title {
    font-size: 26px;
  }
  .search-hero-subtitle {
    font-size: 14.5px;
    margin-bottom: 20px;
  }
  .search-input-wrapper {
    padding: 6px 6px 6px 12px;
  }
  .search-hero-input {
    font-size: 15px;
  }
  .btn-search-submit {
    padding: 10px 16px;
    font-size: 13.5px;
  }
  .btn-search-submit span {
    display: none;
  }
  .search-card {
    padding: 16px;
    gap: 14px;
  }
  .search-card-icon-box {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }
  .search-card-title {
    font-size: 15.5px;
  }
  .search-card-action .action-text {
    display: none;
  }
  .search-categories-grid {
    grid-template-columns: 1fr;
  }
  .search-filter-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==========================================================================
   Blog Posts & Mobile Responsive Tables System
   ========================================================================== */

/* Single Post Featured Image Hero Banner */
.post-featured-image-wrap {
  width: 100%;
  margin: 20px 0 32px 0;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-color);
  background: #0f172a;
}

.post-featured-image {
  width: 100%;
  height: auto;
  max-height: 480px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

/* Blog Category Grid & Rich Cards */
.grid.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 28px;
  margin-top: 28px;
}

.card.post-card.blog-card {
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  text-decoration: none;
  box-shadow: var(--card-shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.card.post-card.blog-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
  box-shadow: 0 16px 36px rgba(79, 70, 229, 0.14);
}

.blog-card-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0f172a;
  position: relative;
}

.blog-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.card.post-card.blog-card:hover .blog-card-thumb img {
  transform: scale(1.04);
}

.blog-card-body {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  flex: 1;
}

.blog-card-title {
  color: var(--text-primary);
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.45;
  transition: color 0.2s ease;
}

.card.post-card.blog-card:hover .blog-card-title {
  color: var(--primary);
}

.blog-read-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--primary);
  margin-top: auto;
}

/* Robust Mobile Responsive Table Wrapper */
.table-responsive-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  margin: 28px 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  position: relative;
  box-sizing: border-box;
}

/* Custom Scrollbar for Responsive Table Wrappers */
.table-responsive-wrapper::-webkit-scrollbar {
  height: 6px;
}
.table-responsive-wrapper::-webkit-scrollbar-track {
  background: var(--bg-subtle);
  border-radius: 4px;
}
.table-responsive-wrapper::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
.table-responsive-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Fallback for legacy overflow-x-auto divs */
.overflow-x-auto {
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* Responsive Table Elements inside Wrapper & Articles */
.table-responsive-wrapper table,
.article table,
.post-article table,
table.data-table {
  width: 100% !important;
  min-width: 100%;
  border-collapse: collapse !important;
  font-size: 14.5px !important;
  background: transparent !important;
  margin: 0 !important;
  border: none !important;
  box-shadow: none !important;
  overflow: visible !important;
}

.table-responsive-wrapper table td:first-child,
.article table td:first-child,
.post-article table td:first-child,
table.data-table td:first-child {
  width: auto !important;
  text-align: left !important;
  color: var(--text-primary) !important;
  font-weight: 500;
  border-right: 1px solid var(--border-subtle) !important;
}

.table-responsive-wrapper table td:last-child,
.article table td:last-child,
.post-article table td:last-child,
table.data-table td:last-child {
  width: auto !important;
  text-align: left !important;
  color: var(--text-primary) !important;
  font-weight: 500;
}

.table-responsive-wrapper table th,
.table-responsive-wrapper table td,
.article table th,
.article table td,
.post-article table th,
.post-article table td,
table.data-table th,
table.data-table td {
  padding: 12px 16px !important;
  border: 1px solid var(--border-subtle) !important;
  line-height: 1.5;
  min-width: 90px;
}

.table-responsive-wrapper table th,
.article table th,
.post-article table th {
  background: var(--primary-light, #eef2ff) !important;
  color: var(--primary, #4f46e5) !important;
  font-weight: 700 !important;
  text-align: left;
  letter-spacing: -0.01em;
}

[data-theme="dark"] .table-responsive-wrapper table th,
[data-theme="dark"] .article table th,
[data-theme="dark"] .post-article table th {
  background: rgba(99, 102, 241, 0.15) !important;
  color: #a5b4fc !important;
}

.table-responsive-wrapper table tbody tr:nth-child(even),
.article table tbody tr:nth-child(even),
.post-article table tbody tr:nth-child(even) {
  background: var(--bg-subtle);
}

.table-responsive-wrapper table tbody tr:hover,
.article table tbody tr:hover,
.post-article table tbody tr:hover {
  background: rgba(99, 102, 241, 0.05);
}

/* Mobile Responsiveness for Blog & Tables (Tablets & Phones) */
@media (max-width: 768px) {
  .post-featured-image-wrap {
    margin: 16px 0 24px 0;
    border-radius: 14px;
  }
  .grid.blog-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
  }
  .blog-card-body {
    padding: 18px 20px;
  }
  .table-responsive-wrapper {
    margin: 20px 0;
    width: 100%;
    max-width: 100%;
    border-radius: 12px;
    box-sizing: border-box;
  }
  .table-responsive-wrapper table,
  .article table,
  .post-article table {
    font-size: 13.5px !important;
    min-width: 100%;
  }
  .table-responsive-wrapper table th,
  .table-responsive-wrapper table td {
    padding: 10px 12px !important;
    min-width: 85px;
  }
}

@media (max-width: 480px) {
  .post-featured-image-wrap {
    margin: 12px 0 20px 0;
    border-radius: 12px;
  }
  .table-responsive-wrapper {
    margin: 16px 0;
    width: 100%;
    max-width: 100%;
    border-radius: 10px;
    box-sizing: border-box;
  }
  .table-responsive-wrapper table,
  .article table,
  .post-article table {
    min-width: 100%;
    font-size: 13px !important;
  }
  .table-responsive-wrapper table th,
  .table-responsive-wrapper table td {
    padding: 8px 10px !important;
    min-width: 75px;
  }
  .article, .post-article {
    word-break: break-word;
    overflow-wrap: break-word;
  }
}

/* Worksheet Interlink CTA Box */
.worksheet-cta-box {
  margin: 36px 0 24px 0;
  padding: 24px 28px;
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-left: 5px solid var(--primary, #4f46e5);
  border-radius: var(--radius-lg, 16px);
  box-shadow: var(--card-shadow, 0 4px 6px -1px rgba(0,0,0,0.05));
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.worksheet-cta-box:hover {
  box-shadow: var(--card-shadow-hover, 0 20px 25px -5px rgba(0,0,0,0.08));
  transform: translateY(-2px);
}
.worksheet-cta-box .worksheet-cta-title {
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--text-primary, #0f172a);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}
.worksheet-cta-box .worksheet-cta-icon {
  font-size: 1.25rem;
  line-height: 1;
}
.worksheet-cta-box .worksheet-cta-text {
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--text-secondary, #475569);
  margin: 0;
}
.worksheet-cta-box .worksheet-cta-link {
  color: var(--primary, #4f46e5);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color .2s ease;
}
.worksheet-cta-box .worksheet-cta-link:hover {
  color: var(--primary-hover, #4338ca);
}
@media (max-width: 640px) {
  .worksheet-cta-box {
    padding: 18px 20px;
    margin: 26px 0 16px 0;
  }
  .worksheet-cta-box .worksheet-cta-title {
    font-size: 1.05rem;
  }
  .worksheet-cta-box .worksheet-cta-text {
    font-size: 14.5px;
  }
}

/* Interactive Table Self-Test Mode */
.home-print-cta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.btn-outline-test {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-md, 10px);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  background: var(--bg-surface, #ffffff);
  border: 1.5px solid var(--primary, #4f46e5);
  color: var(--primary, #4f46e5);
  transition: all .15s ease;
}
.btn-outline-test:hover, .btn-outline-test.active {
  background: var(--primary, #4f46e5);
  color: #ffffff;
  transform: translateY(-1px);
}
.responsive-tables.test-blank-mode table.table-grid td:last-child strong {
  background: #cbd5e1;
  color: transparent !important;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  display: inline-block;
  min-width: 38px;
  padding: 1px 4px;
  text-align: center;
  transition: background .15s, color .15s;
}
.responsive-tables.test-blank-mode table.table-grid td:last-child strong:hover {
  background: #94a3b8;
}
.responsive-tables.test-blank-mode table.table-grid td:last-child strong.revealed {
  background: transparent !important;
  color: inherit !important;
}