/* ============================================
   EIGEN - Site Styles
   Black & white · Inter / Inter Tight · Minimal with character
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Inter+Tight:wght@500;600;700&family=JetBrains+Mono:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  --bg: #000000;
  --text: #ffffff;
  --text-secondary: #999999;
  --text-dim: #555555;
  --border: rgba(255, 255, 255, 0.1);
  --card-bg: rgba(255, 255, 255, 0.03);
  --card-hover: rgba(255, 255, 255, 0.07);
  --font-display: 'Inter Tight', 'Inter', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-code: 'JetBrains Mono', monospace;
  --max-width: 720px;
  --wide-width: 1000px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

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

/* ---- SCROLL ANIMATIONS ---- */
[data-animate] {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

[data-animate].animate-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- HEADER / NAV ---- */
header {
  position: relative;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

nav {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--text);
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-name:hover {
  opacity: 0.8;
}

.hilbert-logo {
  color: var(--text);
  opacity: 0.7;
  transition: opacity 0.2s;
}

.site-name:hover .hilbert-logo {
  opacity: 1;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

/* Hamburger toggle — hidden on desktop */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 4px;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.25s, opacity 0.25s;
}

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

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

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

/* ---- MAIN CONTENT ---- */
main {
  flex: 1;
  width: 100%;
}

/* ---- HERO ---- */
.hero {
  position: relative;
  width: 100%;
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#hilbert-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.hero-gradient-top {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 40%;
  background: linear-gradient(
    to bottom,
    rgb(0, 0, 0) 0%,
    rgba(0, 0, 0, 0.95) 30%,
    rgba(0, 0, 0, 0.7) 60%,
    rgba(0, 0, 0, 0) 100%
  );
  z-index: 1;
  pointer-events: none;
}

.hero-gradient-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40%;
  background: linear-gradient(
    to top,
    rgb(0, 0, 0) 0%,
    rgba(0, 0, 0, 0.95) 30%,
    rgba(0, 0, 0, 0.7) 60%,
    rgba(0, 0, 0, 0) 100%
  );
  z-index: 1;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 700px;
  padding: 0 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 3.75rem;
  line-height: 1.05;
  letter-spacing: -0.035em;
  color: var(--text);
}

.hero-accent {
  color: var(--text-secondary);
}

.hero-tagline {
  font-family: var(--font-body);
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 600px;
}

.hero-bio {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-dim);
  font-weight: 400;
}

/* ---- SECTIONS ---- */
.home-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

.section-heading {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.section-desc {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 1rem;
}

.text-link {
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-decoration: none;
  transition: color 0.2s;
}

.text-link:hover {
  color: var(--text);
}

.pill-link {
  display: inline-flex;
  align-items: center;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 0.5rem 1.25rem;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}

.pill-link:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.25);
}

/* ---- PAGE HEADERS ---- */
.page-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 2rem 2rem;
}

.page-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.page-desc {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* ---- CARDS ---- */
.card-grid {
  display: grid;
  gap: 0;
}

.card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: background 0.2s;
}

.card:first-child {
  border-top: 1px solid var(--border);
}

.card:hover {
  background: var(--card-bg);
  padding-left: 1rem;
  padding-right: 1rem;
  margin-left: -1rem;
  margin-right: -1rem;
  border-radius: 8px;
}

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

.card-arrow {
  font-size: 1.25rem;
  color: var(--text-dim);
  margin-left: 1.5rem;
  flex-shrink: 0;
  transition: color 0.2s, transform 0.2s;
}

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

.card-date {
  font-family: var(--font-code);
  font-size: 0.6875rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0.25rem 0;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.card-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.card-tags {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

/* ---- TAGS ---- */
.tag {
  font-family: var(--font-code);
  font-size: 0.625rem;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  border-radius: 9999px;
}

/* ---- COMING SOON ---- */
.coming-soon {
  text-align: center;
  padding: 8rem 2rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.coming-soon .page-title {
  margin-bottom: 1rem;
}

.coming-soon-text {
  color: var(--text-dim);
  font-size: 1rem;
}

/* ---- VIDEO GALLERY ---- */
.video-grid {
  display: grid;
  gap: 2rem;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

.video-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.video-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.video-player {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #080808;
}

.video-player video {
  width: 100%;
  height: 100%;
  display: block;
}

.video-info {
  padding: 1.25rem 1.5rem;
}

.video-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  letter-spacing: -0.01em;
}

.video-info .card-date {
  display: block;
  margin-bottom: 0.5rem;
}

/* ---- SINGLE POST ---- */
article {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
}

.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.post-date {
  font-family: var(--font-code);
  font-size: 0.75rem;
  color: var(--text-dim);
  display: block;
  margin-bottom: 0.75rem;
}

.post-title {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

.post-description {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.post-tags {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* ---- ARTICLE CONTENT ---- */
.post-content {
  font-size: 1rem;
  line-height: 1.8;
}

.post-content h2 {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.post-content h3 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.post-content p {
  margin-bottom: 1.25rem;
  color: rgba(255, 255, 255, 0.88);
}

.post-content a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--text-dim);
  transition: text-decoration-color 0.2s;
}

.post-content a:hover {
  text-decoration-color: var(--text);
}

.post-content strong {
  font-weight: 600;
  color: var(--text);
}

.post-content em {
  font-style: italic;
}

.post-content blockquote {
  border-left: 2px solid rgba(255, 255, 255, 0.2);
  padding-left: 1.5rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

.post-content code {
  font-family: var(--font-code);
  font-size: 0.875rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  color: var(--text);
}

.post-content pre {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.65;
}

.post-content ul, .post-content ol {
  margin: 1rem 0 1.25rem 1.5rem;
}

.post-content li {
  margin-bottom: 0.4rem;
  color: rgba(255, 255, 255, 0.88);
}

.post-content hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 3rem 0;
}

.post-content img {
  max-width: 100%;
  border-radius: 8px;
}

/* Math (KaTeX) */
.katex-display {
  margin: 1.5rem 0;
  overflow-x: auto;
}

/* ---- FOOTER ---- */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  text-align: center;
}

.footer-content {
  max-width: var(--wide-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-content a {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-content a:hover {
  color: var(--text);
}

.footer-content .sep {
  color: rgba(255, 255, 255, 0.15);
  margin: 0 0.75rem;
  font-size: 0.75rem;
  user-select: none;
}

/* ---- PROJECT ARTICLE (wider layout) ---- */
.project-article {
  max-width: var(--wide-width);
}

/* ---- LACTATE THRESHOLD CALCULATOR ---- */
#lt-app {
  margin-top: 2rem;
}

.lt-section-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

/* Data table */
.lt-table-wrap {
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.lt-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-code);
  font-size: 0.8125rem;
}

.lt-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.lt-table td {
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.lt-row-num {
  color: var(--text-dim);
  font-size: 0.6875rem;
  width: 2rem;
  text-align: center;
}

.lt-pace-cell {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  white-space: nowrap;
}

.lt-input {
  font-family: var(--font-code);
  font-size: 0.875rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 0.4rem 0.6rem;
  width: 100px;
  transition: border-color 0.2s;
}

.lt-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.3);
}

/* Buttons */
.lt-btn-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.lt-btn {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.lt-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.25);
}

.lt-btn-primary {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.lt-btn-primary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.35);
}

/* Error message */
.lt-error {
  color: #ff6b6b;
  font-size: 0.8125rem;
  margin-bottom: 1rem;
  display: none;
}

/* Chart */
.lt-chart-section {
  display: none;
  margin-bottom: 2.5rem;
}

.lt-chart-wrap {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
}

#lt-chart {
  width: 100%;
  height: 400px;
  display: block;
}

/* Results section */
.lt-results-section {
  display: none;
}

.lt-results-group {
  margin-bottom: 2rem;
}

.lt-results-group-title {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.lt-obla-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.lt-result-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  transition: border-color 0.2s;
}

.lt-result-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.lt-result-label {
  font-family: var(--font-code);
  font-size: 0.625rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}

.lt-result-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lt-result-unit {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.lt-result-sub {
  font-family: var(--font-code);
  font-size: 0.6875rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

.lt-result-na {
  color: var(--text-dim);
}

.lt-other-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

/* Method explanation panels */
.lt-methods-section {
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  padding-top: 2rem;
}

.lt-method-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.75rem 0;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  background: transparent;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: color 0.2s;
}

.lt-method-toggle:hover {
  color: var(--text-secondary);
}

.lt-method-toggle::after {
  content: '+';
  font-family: var(--font-code);
  font-size: 1rem;
  color: var(--text-dim);
  transition: transform 0.2s;
}

.lt-method-toggle.lt-toggle-open::after {
  content: '−';
}

.lt-method-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.lt-method-panel-inner {
  padding: 1rem 0 1.5rem;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.7;
}

.lt-method-panel-inner p {
  margin-bottom: 0.75rem;
}

.lt-method-panel-inner .katex-display {
  margin: 1rem 0;
}

/* LT1/LT2 threshold badges */
.lt-tag {
  font-family: var(--font-code);
  font-size: 0.5625rem;
  letter-spacing: 0.05em;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.lt-tag-lt1 {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.lt-tag-lt2 {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  nav { padding: 0.875rem 1.25rem; }
  .hero { min-height: 70vh; }
  .hero-title { font-size: 2.25rem; }
  .hero-tagline { font-size: 1rem; }
  .home-section { padding: 0 1.25rem 3rem; }
  .page-header { padding: 2rem 1.25rem 1.5rem; }
  article { padding: 2rem 1.25rem 3rem; }
  .post-title { font-size: 1.75rem; }
  .page-title { font-size: 2rem; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 0.75rem 1.25rem 1rem;
    gap: 0;
  }
  .nav-links.nav-open {
    display: flex;
  }
  .nav-links li {
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }
  .nav-links li:last-child {
    border-bottom: none;
  }
  .nav-links a {
    font-size: 0.875rem;
  }
  .nav-toggle {
    display: flex;
  }
  footer { padding: 1.25rem; }
  .footer-content a { font-size: 0.75rem; }
  .footer-content .sep { margin: 0 0.5rem; }
  .video-grid { padding: 0 1.25rem 3rem; }
  .card:hover {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    margin-left: -0.75rem;
    margin-right: -0.75rem;
  }
  .project-article {
    padding: 2rem 1.25rem 3rem;
    overflow-x: hidden;
  }
  .fc-btn-row, .mcq-btn-row {
    flex-wrap: wrap;
  }
  .fc-btn, .mcq-btn {
    font-size: 0.75rem;
    padding: 0.45rem 1rem;
  }
  #fc-chapter-filters, #mcq-chapter-filters {
    gap: 0.4rem 0.75rem;
  }
  .sl-explore-stats {
    flex-wrap: wrap;
  }
  .sl-explore-stat {
    flex: 0 0 33.33%;
  }
  #lt-chart { height: 280px; }
  .lt-obla-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .lt-other-results { grid-template-columns: 1fr; }
  .lt-input { width: 70px; }
  .lt-result-value { font-size: 1.25rem; }
}

/* ============================================
   FLASHCARD APP
   ============================================ */

/* ---- Container ---- */
#fc-app {
  margin-top: 2rem;
  overflow: hidden;
}

#sl-app {
  overflow: hidden;
}

/* ---- Utility ---- */
.fc-hidden {
  display: none;
}

/* ---- Nav Tabs ---- */
.fc-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.fc-tab {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.fc-tab:hover {
  color: var(--text-secondary);
}

.fc-tab-active {
  color: var(--text);
  border-bottom-color: var(--text);
}

/* ---- Dashboard ---- */
.fc-dashboard {
}

.fc-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.fc-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  transition: border-color 0.2s;
}

.fc-stat-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.fc-stat-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}

.fc-stat-label {
  font-family: var(--font-code);
  font-size: 0.625rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.25rem;
}

/* Filters */
.fc-filters {
  margin-bottom: 1.5rem;
}

.fc-filters-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.fc-filters-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.fc-filters-list label,
#fc-chapter-filters label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s;
}

.fc-filters-list label:hover,
#fc-chapter-filters label:hover {
  color: var(--text);
}

.fc-filters-list input[type="checkbox"],
#fc-chapter-filters input[type="checkbox"] {
  accent-color: var(--text);
}

#fc-chapter-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

/* Buttons */
.fc-btn-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.fc-btn {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.fc-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.25);
}

.fc-btn-primary {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.fc-btn-primary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.35);
}

/* ---- Study View ---- */
.fc-study {
}

.fc-progress {
  font-family: var(--font-code);
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 1rem;
  letter-spacing: 0.02em;
}

.fc-card-container {
  perspective: 1000px;
  margin-bottom: 1.5rem;
}

.fc-card {
  position: relative;
  width: 100%;
  height: 500px;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.fc-card.fc-card-flipped {
  transform: rotateY(180deg);
}

.fc-card-front,
.fc-card-back {
  backface-visibility: hidden;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.fc-card-back {
  transform: rotateY(180deg);
}

/* Card content typography */
.fc-card-content {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.88);
  text-align: center;
  width: 100%;
}

.fc-card-content h1,
.fc-card-content h2,
.fc-card-content h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.fc-card-content p {
  margin-bottom: 1rem;
}

.fc-card-content ul,
.fc-card-content ol {
  margin: 0.75rem 0 1rem 1.5rem;
  text-align: left;
}

.fc-card-content li {
  margin-bottom: 0.35rem;
}

.fc-card-content code {
  font-family: var(--font-code);
  font-size: 0.875rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.fc-card-content pre {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
  text-align: left;
}

.fc-card-content pre code {
  background: none;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.6;
}

.fc-card-content .katex-display {
  margin: 1rem 0;
}

/* Rating buttons */
.fc-rating-row {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.fc-rating-btn {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.6rem 1.25rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-width: 5rem;
}

.fc-rating-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.25);
}

.fc-rating-interval {
  font-family: var(--font-code);
  font-size: 0.625rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

/* ---- Browse View ---- */
.fc-browse {
}

.fc-search {
  font-family: var(--font-body);
  font-size: 0.875rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.6rem 1rem;
  width: 100%;
  margin-bottom: 1rem;
  transition: border-color 0.2s;
}

.fc-search:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.3);
}

.fc-search::placeholder {
  color: var(--text-dim);
}

.fc-browse-list {
  max-height: 600px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}

.fc-browse-item {
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

.fc-browse-item:hover {
  background: var(--card-bg);
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  margin-left: -0.75rem;
  margin-right: -0.75rem;
  border-radius: 6px;
}

.fc-browse-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.fc-browse-preview {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fc-chapter-tag {
  font-family: var(--font-code);
  font-size: 0.5625rem;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  border-radius: 9999px;
  display: block;
  width: fit-content;
  margin: 0 auto 1.5rem;
}

.fc-browse-status {
  font-family: var(--font-code);
  font-size: 0.5625rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fc-browse-detail {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.875rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.75);
}

.fc-browse-detail strong {
  color: var(--text);
}

.fc-browse-front {
  margin-bottom: 0.75rem;
}

.fc-browse-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.875rem;
}

/* ---- Responsive (Flashcard) ---- */
@media (max-width: 768px) {
  .fc-stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Disable 3D flip on mobile — use show/hide instead */
  .fc-card {
    height: auto;
    min-height: 250px;
    transform-style: flat;
  }

  .fc-card.fc-card-flipped {
    transform: none;
  }

  .fc-card-front,
  .fc-card-back {
    position: relative;
    height: auto;
    min-height: 250px;
    backface-visibility: visible;
    transform: none;
  }

  .fc-card-front {
    display: flex;
  }

  .fc-card-back {
    display: none;
    transform: none;
  }

  .fc-card.fc-card-flipped .fc-card-front {
    display: none;
  }

  .fc-card.fc-card-flipped .fc-card-back {
    display: flex;
  }

  .fc-rating-row {
    margin-top: 0.75rem;
  }

  .fc-rating-btn {
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
    min-width: 4rem;
  }

  .fc-rating-interval {
    font-size: 0.5625rem;
  }

  .fc-chapter-tag {
    margin-bottom: 0.5rem;
  }

  .fc-browse-list {
    max-height: none;
  }

  .fc-browse-item:hover {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

/* ============================================
   MCQ QUIZ APP
   ============================================ */

/* ---- Utility ---- */
.mcq-hidden {
  display: none;
}

/* ---- Dashboard Stats ---- */
.mcq-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.mcq-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  transition: border-color 0.2s;
}

.mcq-stat-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.mcq-stat-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}

.mcq-stat-label {
  font-family: var(--font-code);
  font-size: 0.625rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.25rem;
}

/* ---- Chapter Filters ---- */
.mcq-filters {
  margin-bottom: 1.5rem;
}

.mcq-filters-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.mcq-filter-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.mcq-filter-btn {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.mcq-filter-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text);
}

.mcq-filter-btn.mcq-filter-active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--text);
}

/* ---- Question Card ---- */
.mcq-question-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.mcq-question-text {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--text);
}

.mcq-question-text code {
  font-family: var(--font-code);
  font-size: 0.875rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.mcq-question-chapter {
  font-family: var(--font-code);
  font-size: 0.625rem;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  border-radius: 9999px;
  display: inline-block;
  margin-bottom: 0.75rem;
}

/* ---- Choice Buttons ---- */
.mcq-choices {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-bottom: 1.5rem;
}

.mcq-choice {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.875rem 1.25rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s, border-color 0.2s;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.mcq-choice:hover:not(.mcq-choice-disabled) {
  background: var(--card-hover);
  border-color: rgba(255, 255, 255, 0.25);
}

.mcq-choice-letter {
  font-family: var(--font-code);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  flex-shrink: 0;
}

.mcq-choice-correct {
  border-color: #4caf50;
  background: rgba(76, 175, 80, 0.08);
}

.mcq-choice-wrong {
  border-color: #f44336;
  background: rgba(244, 67, 54, 0.08);
}

.mcq-choice-reveal {
  border-color: #4caf50;
  background: rgba(76, 175, 80, 0.05);
}

.mcq-choice-disabled {
  cursor: default;
  opacity: 0.85;
}

/* ---- Explanation Box ---- */
.mcq-explanation {
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid rgba(255, 255, 255, 0.15);
  border-radius: 0 8px 8px 0;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.8);
}

.mcq-explanation code {
  font-family: var(--font-code);
  font-size: 0.875rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.mcq-explanation-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

/* ---- Progress Bar ---- */
.mcq-progress {
  font-family: var(--font-code);
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 1rem;
  letter-spacing: 0.02em;
}

.mcq-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.mcq-progress-fill {
  height: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ---- Review List ---- */
.mcq-review-list {
  max-height: 600px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}

.mcq-review-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.mcq-review-question {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.mcq-review-answer {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  line-height: 1.5;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  display: inline-block;
}

.mcq-review-answer-correct {
  color: #4caf50;
  background: rgba(76, 175, 80, 0.08);
}

.mcq-review-answer-wrong {
  color: #f44336;
  background: rgba(244, 67, 54, 0.08);
}

.mcq-review-correct-answer {
  font-family: var(--font-code);
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

/* ---- Number Input ---- */
.mcq-count-input {
  font-family: var(--font-code);
  font-size: 0.875rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 0.4rem 0.6rem;
  width: 70px;
  transition: border-color 0.2s;
  text-align: center;
}

.mcq-count-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.3);
}

/* ---- Buttons (MCQ) ---- */
.mcq-btn-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  align-items: center;
}

.mcq-btn {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.mcq-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.25);
}

.mcq-btn-primary {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.mcq-btn-primary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.35);
}

/* ---- Chapter Tag (MCQ) ---- */
.mcq-chapter-tag {
  font-family: var(--font-code);
  font-size: 0.625rem;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  border-radius: 9999px;
  display: inline-block;
}

/* ---- Chapter Filters Checkboxes (MCQ) ---- */
#mcq-chapter-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

#mcq-chapter-filters label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s;
}

#mcq-chapter-filters label:hover {
  color: var(--text);
}

#mcq-chapter-filters input[type="checkbox"] {
  accent-color: var(--text);
}

/* ---- Completion (MCQ) ---- */
.mcq-completion {
  text-align: center;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--text);
}

/* ---- Review Explanation (MCQ) ---- */
.mcq-review-explanation {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.65);
}

.mcq-review-explanation strong {
  color: var(--text-secondary);
}

/* ---- Responsive (MCQ) ---- */
@media (max-width: 768px) {
  .mcq-stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .mcq-question-card {
    padding: 1.5rem;
  }

  .mcq-choice {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }

  .mcq-explanation {
    padding: 1rem 1.25rem;
  }

  .mcq-review-list {
    max-height: none;
  }
}

/* ============================================
   STUDY LAB
   ============================================ */

/* ---- Streak Bar ---- */
.sl-streak-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  margin-bottom: 1rem;
  font-family: var(--font-code);
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.sl-streak-icon {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ---- Filter Pills (shared by Review + Quiz) ---- */
#fc-chapter-filters,
#mcq-chapter-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sl-filter-pill {
  font-family: var(--font-code);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  letter-spacing: 0.02em;
}

.sl-filter-pill:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text-secondary);
}

.sl-filter-pill.sl-filter-pill-active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--text);
}

/* ---- Tab Navigation ---- */
.sl-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.sl-tab {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.sl-tab:hover:not(.sl-tab-disabled) {
  color: var(--text-secondary);
}

.sl-tab-active {
  color: var(--text);
  border-bottom-color: var(--text);
}

.sl-tab-disabled {
  color: var(--text-dim);
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---- Tab Panels ---- */
.sl-tab-panel {
  /* visible by default */
}

.sl-hidden {
  display: none;
}

/* ---- Section Labels (Stats) ---- */
.sl-section-label {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

/* ---- Stats Overview Grid ---- */
.sl-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.sl-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  transition: border-color 0.2s;
}

.sl-stat-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.sl-stat-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}

.sl-stat-label {
  font-family: var(--font-code);
  font-size: 0.625rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.25rem;
}

/* ---- Mastery Rings ---- */
.sl-mastery-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.sl-mastery-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.sl-ring-svg {
  width: 80px;
  height: 80px;
}

.sl-mastery-label {
  font-family: var(--font-code);
  font-size: 0.625rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sl-mastery-pct {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ---- Heat Map ---- */
.sl-heat-container {
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.sl-heat-months {
  display: flex;
  padding-left: 2rem;
  margin-bottom: 0.25rem;
}

.sl-heat-month {
  font-family: var(--font-code);
  font-size: 0.5625rem;
  color: var(--text-dim);
  letter-spacing: 0.03em;
}

.sl-heat-body {
  display: flex;
  gap: 0;
}

.sl-heat-days {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-right: 0.5rem;
  height: calc(7 * 13px + 6 * 3px);
}

.sl-heat-day-label {
  font-family: var(--font-code);
  font-size: 0.5rem;
  color: var(--text-dim);
  line-height: 13px;
}

.sl-heat-grid {
  display: grid;
  grid-template-rows: repeat(7, 13px);
  grid-auto-flow: column;
  grid-auto-columns: 13px;
  gap: 3px;
}

.sl-heat-cell {
  width: 13px;
  height: 13px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 2px;
  transition: background 0.15s;
}

.sl-heat-cell:hover {
  outline: 1px solid rgba(255, 255, 255, 0.3);
}

.sl-heat-1 {
  background: rgba(255, 255, 255, 0.12);
}

.sl-heat-2 {
  background: rgba(255, 255, 255, 0.25);
}

.sl-heat-3 {
  background: rgba(255, 255, 255, 0.45);
}

.sl-heat-4 {
  background: rgba(255, 255, 255, 0.7);
}

/* ---- Responsive (Study Lab) ---- */
@media (max-width: 768px) {
  .sl-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sl-tab {
    font-size: 0.75rem;
    padding: 0.6rem 0.875rem;
    white-space: nowrap;
  }

  .sl-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .sl-mastery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }

  .sl-ring-svg {
    width: 64px;
    height: 64px;
  }

  .sl-heat-grid {
    grid-template-rows: repeat(7, 11px);
    grid-auto-columns: 11px;
    gap: 2px;
  }

  .sl-heat-cell {
    width: 11px;
    height: 11px;
  }

  .sl-heat-days {
    height: calc(7 * 11px + 6 * 2px);
  }
}

/* ============================================
   REFERENCE TAB
   ============================================ */

/* ---- Chapter Groups ---- */
.sl-ref-group {
  margin-bottom: 0.5rem;
}

.sl-ref-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.875rem 0;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: color 0.2s;
}

.sl-ref-group-header:hover {
  color: var(--text);
}

.sl-ref-group-header::before {
  content: '+';
  font-family: var(--font-code);
  font-size: 1rem;
  color: var(--text-dim);
  margin-right: 0.75rem;
  flex-shrink: 0;
  width: 1rem;
  text-align: center;
  transition: transform 0.2s;
}

.sl-ref-group-header.sl-ref-group-open::before {
  content: '\2212';
}

.sl-ref-group-title {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  flex: 1;
}

.sl-ref-group-count {
  font-family: var(--font-code);
  font-size: 0.625rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  letter-spacing: 0.03em;
}

.sl-ref-group-items {
  padding-left: 1rem;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  margin-left: 0.45rem;
}

/* ---- Individual Items ---- */
.sl-ref-item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background 0.2s;
}

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

.sl-ref-item:hover {
  background: var(--card-bg);
}

.sl-ref-item-collapsed {
  padding: 0.625rem 0.5rem;
}

.sl-ref-item:hover .sl-ref-item-collapsed {
  padding-left: 0.75rem;
}

.sl-ref-item-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sl-ref-term {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.sl-ref-section {
  font-family: var(--font-code);
  font-size: 0.5625rem;
  color: var(--text-dim);
  letter-spacing: 0.03em;
}

.sl-ref-item-detail {
  padding: 0.5rem 0.5rem 1rem;
}

.sl-ref-item:hover .sl-ref-item-detail {
  padding-left: 0.75rem;
}

.sl-ref-definition {
  font-size: 0.875rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 0.75rem;
}

.sl-ref-definition strong {
  color: var(--text);
}

.sl-ref-equations {
  margin-bottom: 0.75rem;
}

.sl-ref-eq {
  font-family: var(--font-code);
  font-size: 0.875rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  overflow-x: auto;
  color: var(--text);
}

.sl-ref-links {
  font-family: var(--font-code);
  font-size: 0.6875rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.sl-ref-empty {
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.875rem;
}

/* ============================================
   EXPLORE TAB (Chapter Deep Dive)
   ============================================ */

/* Chapter selector pills */
.sl-explore-chapters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.sl-explore-ch-btn {
  font-family: var(--font-code);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.4rem 0.875rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  letter-spacing: 0.02em;
}

.sl-explore-ch-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text);
}

.sl-explore-ch-btn.sl-explore-ch-active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--text);
}

/* Chapter header */
.sl-explore-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.sl-explore-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sl-explore-ch-num {
  font-family: var(--font-code);
  font-size: 0.6875rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.25rem;
}

.sl-explore-ch-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
}

.sl-explore-ring {
  flex-shrink: 0;
}

/* Stats row */
.sl-explore-stats {
  display: flex;
  gap: 0;
  margin-bottom: 0.5rem;
}

.sl-explore-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.875rem 0.5rem;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sl-explore-stat:last-child {
  border-right: none;
}

.sl-explore-stat-val {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.sl-explore-stat-lbl {
  font-family: var(--font-code);
  font-size: 0.5625rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.15rem;
}

/* Concepts grid */
.sl-explore-concepts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.sl-explore-concept {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  transition: border-color 0.2s;
}

.sl-explore-concept:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.sl-explore-concept-name {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}

.sl-explore-concept-desc {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Key equations */
.sl-explore-equations {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.sl-explore-eq-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  overflow: hidden;
}

.sl-explore-eq-card .katex-display {
  overflow: hidden;
  margin: 0.75rem 0;
}

.sl-explore-eq-card .katex {
  font-size: 0.95em;
}

.sl-explore-eq-term {
  font-family: var(--font-code);
  font-size: 0.625rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.sl-explore-eq-math {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.8;
  margin-bottom: 0.5rem;
}

.sl-explore-eq-desc {
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

/* Weakest cards */
.sl-explore-weak-list {
  margin-bottom: 0.5rem;
}

.sl-explore-weak-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  gap: 1rem;
}

.sl-explore-weak-item:last-child {
  border-bottom: none;
}

.sl-explore-weak-text {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}

.sl-explore-weak-ease {
  font-family: var(--font-code);
  font-size: 0.6875rem;
  color: var(--text-dim);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

/* ---- Responsive (Reference + Explore) ---- */
@media (max-width: 768px) {
  .sl-ref-group-items {
    padding-left: 0.5rem;
  }

  .sl-ref-item-collapsed {
    padding: 0.5rem 0.25rem;
  }

  .sl-explore-ch-title {
    font-size: 1.375rem;
  }

  .sl-explore-stats {
    flex-wrap: wrap;
  }

  .sl-explore-stat {
    flex: 0 0 33.33%;
  }

  .sl-explore-concepts {
    grid-template-columns: 1fr;
  }

  .sl-explore-equations {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   Markdown tables (rendered from |---|---| syntax)
   ============================================ */

.post-content table,
.single-content table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-code);
  font-size: 0.8125rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  display: block;
}

.post-content table th,
.single-content table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.post-content table td,
.single-content table td {
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}

.post-content table tr:hover td,
.single-content table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}
