:root {
  --edupace-dark: #0b0f1a;
  --edupace-panel: #ffffff;
  --edupace-border: #e2e8f0;
  --edupace-accent: #33ff66;
  --edupace-accent-soft: rgba(15, 23, 42, 0.08);
  --edupace-text: #0f172a;
  --edupace-muted: #64748b;
}

body.edupace-toc-auto .edupace-toc {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

body.edupace-toc-auto .edupace-toc.is-hidden {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

body.edupace-toc-auto .edupace-toc.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.edupace-layout {
  display: block;
}

.edupace-body {
  min-width: 0;
}

.edupace-section[data-edupace-section] {
  scroll-margin-top: 120px;
}

.edupace-section {
  margin-bottom: calc(var(--space-xl) + var(--space-lg));
}

.overview-section .overview-intro {
  gap: var(--space-lg);
}

.overview-section .overview-cards {
  gap: var(--space-lg);
}

.edupace-timeline {
  gap: calc(var(--space-xl) + var(--space-md));
}

.timeline-step {
  gap: var(--space-md);
}

.timeline-step__content {
  gap: var(--space-lg);
}

.timeline-step__content + .timeline-step__content {
  margin-top: var(--space-lg);
}

.timeline-step--device .device-overview {
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  padding: var(--space-md);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.06);
  align-items: center;
}

.device-details {
  display: grid;
  gap: var(--space-sm);
}

.device-details h4 {
  margin-bottom: 0.35rem;
}

.device-details p {
  margin: 0;
  color: var(--edupace-muted);
}

.device-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.device-spec {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #ffffff;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0f172a;
}

.device-feature-list {
  margin-top: var(--space-sm);
}

.photo-card--device {
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.12);
}

.photo-card--device img {
  height: clamp(220px, 34vw, 320px);
  object-fit: cover;
}

.edupace-body .feature-list {
  margin: 0.2rem 0 0.75rem;
  padding-left: 0;
}

.edupace-body p + .feature-list {
  margin-top: 0.15rem;
}

.edupace-body .feature-list li {
  margin-bottom: 0.4rem;
  padding-left: 1.2rem;
  line-height: 1.45;
  color: var(--edupace-text);
}

.edupace-body .feature-list li::before {
  color: var(--edupace-text);
  font-size: 0.95rem;
}

.edupace-body .feature-list li:last-child {
  margin-bottom: 0;
}

.edupace-toc {
  display: none;
}

.edupace-toc__inner {
  display: grid;
  gap: 1rem;
  padding: 1.25rem 1.2rem;
  border-radius: 20px;
  background: var(--edupace-panel);
  border: 1px solid var(--edupace-border);
  box-shadow: 0 18px 28px rgba(15, 23, 42, 0.08);
}

.edupace-toc__title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--edupace-muted);
}

.edupace-toc__nav {
  position: relative;
  display: grid;
  gap: 0.85rem;
  padding-left: 1.25rem;
}

.edupace-toc__nav::before {
  content: "";
  position: absolute;
  left: 0.45rem;
  top: 0.3rem;
  bottom: 0.3rem;
  width: 2px;
  border-radius: 999px;
  background: #e2e8f0;
}

.edupace-toc__link {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 0.6rem;
  align-items: center;
  text-decoration: none;
  color: var(--edupace-muted);
  font-size: 0.9rem;
  transition: color 0.2s ease, transform 0.2s ease;
}

.edupace-toc__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid #cbd5f5;
  background: #f8fafc;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.15);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.edupace-toc__label {
  color: inherit;
}

.edupace-toc__link.is-active,
.edupace-toc__link[aria-current="true"] {
  color: var(--edupace-text);
  transform: translateX(2px);
}

.edupace-toc__link.is-active .edupace-toc__dot,
.edupace-toc__link[aria-current="true"] .edupace-toc__dot {
  border-color: #0f172a;
  background: #0f172a;
  box-shadow: 0 0 0 4px var(--edupace-accent-soft);
}

.edupace-toc__link.is-active .edupace-toc__label,
.edupace-toc__link[aria-current="true"] .edupace-toc__label {
  font-weight: 600;
}

@media (min-width: 1100px) {
  .edupace-toc {
    display: block;
    position: fixed;
    top: 120px;
    right: clamp(1rem, 3vw, 2.5rem);
    width: 210px;
    z-index: 10;
  }
}

.ecg-widget {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.08);
  color: #0f172a;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 900px) {
  .ecg-widget {
    max-width: 50%;
  }
}

.ecg-widget__header h4 {
  color: #0f172a;
}

.ecg-widget__header p,
.ecg-control,
.ecg-widget__header,
.ecg-control__label {
  color: #475569;
}

.ecg-widget__note {
  display: inline-flex;
  margin-top: 0.4rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #0f172a;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ecg-widget__scenarios {
  gap: 0.6rem;
}

.ecg-scenario {
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: #0f172a;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
}

.ecg-scenario.is-active {
  background: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
}

.ecg-monitor {
  position: relative;
  padding: 0.75rem;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: radial-gradient(circle at top left, rgba(51, 255, 102, 0.08), transparent 45%),
    #05070c;
  box-shadow: inset 0 0 0 1px rgba(51, 255, 102, 0.08), 0 12px 24px rgba(0, 0, 0, 0.35);
}

.ecg-monitor__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.7);
  margin-bottom: 0.5rem;
}

.ecg-monitor__status {
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(51, 255, 102, 0.4);
  color: var(--edupace-accent);
  background: rgba(51, 255, 102, 0.08);
}

.ecg-monitor__canvas {
  width: 100%;
  height: 220px;
  display: block;
  border-radius: 12px;
  background: #000;
  border: 1px solid rgba(15, 23, 42, 0.9);
}

.ecg-step {
  border-radius: 12px;
  border: 1px solid #cbd5f5;
  background: #f8fafc;
  color: #0f172a;
}

.ecg-step:hover {
  border-color: var(--edupace-accent);
}

.ecg-value {
  color: #0f172a;
}

.timeline-step__content--split .ecg-widget {
  grid-column: auto;
  justify-self: end;
  width: 100%;
  max-width: none;
}

.ecg-paper {
  position: relative;
  padding: 0.75rem;
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.6);
  background: #ffffff;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.ecg-paper__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.5rem;
}

.ecg-paper__status {
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  background: #f8fafc;
}

.ecg-paper__canvas {
  width: 100%;
  height: 200px;
  display: block;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.ecg-control__buttons {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ecg-step {
  width: 28px;
  height: 28px;
}

.ecg-value {
  min-width: 4.5rem;
  text-align: center;
}

/* --- Bézier ECG widget --- */
.bezier-widget{
  width: min(480px, 100%);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.system-block--split {
  display: grid;
  gap: var(--space-lg);
}

.timeline-step__content--app {
  gap: var(--space-lg);
}

.edupace-app-features {
  margin: var(--space-md) 0 0;
  grid-template-columns: minmax(0, 1fr);
}

.edupace-app-carousel {
  padding: var(--space-md);
}

.edupace-app-carousel .photo-toggle__image {
  min-height: 320px;
  object-fit: cover;
}

.edupace-app-carousel .photo-toggle__nav {
  bottom: var(--space-md);
}

.edupace-casing-carousel {
  padding: var(--space-md);
}

.edupace-casing-carousel .photo-toggle__image {
  height: 380px;
  width: 100%;
  object-fit: cover;
}

.edupace-casing-carousel .photo-toggle__nav {
  bottom: var(--space-md);
}

@media (min-width: 900px) {
  .edupace-app-features {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 700px) {
  .edupace-app-features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .system-block--split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    align-items: start;
  }

  .system-block--split .system-block__content {
    justify-self: end;
    width: 100%;
  }

  .bezier-widget {
    margin-left: auto;
  }

  .timeline-step--device .device-overview {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  }
}

.bezier-widget__toolbar{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border, #e5e7eb);
  flex-wrap: wrap;
}

.bezier-tab{
  appearance: none;
  border: 1px solid var(--color-border, #e5e7eb);
  background: #fff;
  color: var(--color-text, #111827);
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  line-height: 1;
  cursor: pointer;
}

.bezier-tab.is-active{
  border-color: rgba(218, 41, 28, 0.45);
  box-shadow: 0 0 0 3px rgba(218, 41, 28, 0.12);
}

.bezier-chips{
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.bezier-chip{
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--color-border, #e5e7eb);
  color: rgba(17, 24, 39, 0.65);
  background: #fff;
  box-sizing: border-box;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-variant-numeric: tabular-nums;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  line-height: 1.2;
  height: calc(2 * 1.2em + 4px);
}

.bezier-widget__canvasWrap{
  border-bottom: 1px solid var(--color-border, #e5e7eb);
}

.bezier-widget__canvas{
  width: 100%;
  height: 295px; /* taller */
  display: block;
}

.bezier-equation{
  margin-top: 28px;
  padding: 20px 24px;
  border-radius: 12px;
  border: 1px solid var(--color-border, #e5e7eb);
  background: #fff;
  overflow: hidden;
  line-height: 1.5;
  font-size: clamp(0.6rem, 1.2vw, 0.85rem);
}

.bezier-equation .katex-display{
  margin: 0;
}

.bezier-equation .katex{
  max-width: 100%;
}

@media (max-width: 720px) {
  .edupace-hero {
    gap: var(--space-md);
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .button {
    width: 100%;
    justify-content: center;
  }

  .timeline-step {
    padding-left: var(--space-sm);
  }

  .timeline-step::before {
    left: -6px;
  }

  .timeline-step__content--split,
  .timeline-step--final .timeline-step__content--split {
    grid-template-columns: 1fr;
  }

  .ecg-widget__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .ecg-widget {
    padding: var(--space-sm);
    gap: var(--space-sm);
  }

  .ecg-widget__scenarios {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    -webkit-overflow-scrolling: touch;
  }

  .ecg-scenario {
    flex: 0 0 auto;
    font-size: 0.72rem;
  }

  .ecg-widget__body {
    gap: var(--space-sm);
  }

  .ecg-paper,
  .ecg-monitor {
    padding: 0.5rem;
    border-radius: 14px;
  }

  .ecg-paper__meta,
  .ecg-monitor__meta {
    font-size: 0.6rem;
  }

  .ecg-monitor__canvas {
    height: 160px;
  }

  .ecg-paper__canvas {
    height: 160px;
  }

  .bezier-widget__canvas {
    height: 220px;
  }

  .bezier-chips {
    flex-wrap: nowrap;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .bezier-chip {
    flex: 0 0 auto;
  }
}
