:root {
  color-scheme: dark;
  --bg: #08090b;
  --surface: #111318;
  --surface-2: #171a20;
  --ink: #f6f2e8;
  --muted: #a9adb4;
  --line: rgba(255, 255, 255, 0.13);
  --cyan: #78dce8;
  --gold: #f4d35e;
  --rose: #ff7a90;
  --green: #8ee8a4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 22% 4%, rgba(120, 220, 232, 0.14), transparent 30rem),
    radial-gradient(circle at 84% 20%, rgba(255, 122, 144, 0.12), transparent 34rem),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.shell {
  width: min(1480px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 36px 0 64px;
}

.hero {
  min-height: 32svh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 360px;
  align-items: center;
  gap: 44px;
  padding: 26px 0 42px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 1050px;
  font-size: clamp(44px, 7vw, 108px);
  line-height: 0.92;
}

h2 {
  max-width: 960px;
  font-size: clamp(26px, 3vw, 48px);
  line-height: 1.02;
}

.lede {
  max-width: 820px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 1.35vw, 21px);
  line-height: 1.65;
}

.hero-orbit {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  opacity: 0.92;
}

.hero-orbit span {
  position: absolute;
  inset: 18%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  animation: orbit 7s linear infinite;
}

.hero-orbit span:nth-child(2) {
  inset: 31%;
  border-color: rgba(244, 211, 94, 0.42);
  animation-duration: 5s;
  animation-direction: reverse;
}

.hero-orbit span:nth-child(3) {
  inset: 44%;
  background: var(--cyan);
  border: 0;
  box-shadow: 0 0 48px rgba(120, 220, 232, 0.8);
}

.module {
  margin-top: 28px;
  padding: 28px;
  background: rgba(17, 19, 24, 0.84);
  border: 1px solid var(--line);
  border-radius: 8px;
  backdrop-filter: blur(18px);
  content-visibility: auto;
  contain-intrinsic-size: 760px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.carousel-controls,
.dots,
.stats,
.technique-meta {
  display: flex;
  align-items: center;
}

.carousel-controls {
  gap: 14px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font-size: 28px;
  cursor: pointer;
}

.dots {
  gap: 8px;
}

.dots button {
  width: 34px;
  height: 4px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  cursor: pointer;
}

.dots button.active {
  background: var(--gold);
}

.technique-meta {
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding-top: 2px;
}

#techniqueName {
  display: block;
  font-size: 28px;
  font-weight: 800;
}

#techniqueMotion {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
}

.stats {
  flex-wrap: wrap;
  justify-content: end;
  gap: 8px;
}

.stats span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

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

.panel {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.panel-label {
  position: absolute;
  z-index: 2;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: rgba(246, 242, 232, 0.8);
  font-size: 12px;
}

.panel-label b {
  color: var(--ink);
}

body[data-embed] {
  background: #0c0e12;
}

body[data-embed] .shell {
  width: 100%;
  padding: 0;
}

body[data-embed] .hero {
  display: none;
}

body[data-embed="learning"] .engine-module,
body[data-embed="engine"] .learning-module {
  display: none;
}

body[data-embed] .module {
  margin: 0;
  border-radius: 0;
  border-color: rgba(255, 255, 255, 0.12);
  background: #101318;
}

body[data-embed] .engine-stage {
  min-height: 640px;
}

body[data-embed="learning"] .learning-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

body[data-embed="learning"] .panel {
  min-height: 420px;
}

body[data-embed="learning"] .section-head {
  margin-bottom: 18px;
}

body[data-embed="learning"] h2 {
  font-size: clamp(24px, 4.4vw, 42px);
}

body[data-embed="learning"] .technique-meta {
  margin-bottom: 14px;
}

video,
canvas {
  display: block;
  width: 100%;
  height: 100%;
}

video {
  object-fit: cover;
  filter: saturate(0.88) contrast(1.05);
}

.curve-panel > canvas,
.signature-panel > canvas {
  position: absolute;
  inset: 0;
}

.seed-list {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 82px;
  bottom: 16px;
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
}

.signature-entry {
  display: grid;
  grid-template-columns: minmax(128px, 0.68fr) minmax(170px, 1fr);
  grid-template-areas:
    "name glyph"
    "meta glyph"
    "info glyph";
  gap: 6px 14px;
  min-height: 108px;
  padding: 12px;
  border: 1px solid rgba(244, 211, 94, 0.35);
  border-radius: 6px;
  background: rgba(244, 211, 94, 0.055);
  font-size: 12px;
}

.signature-entry.active {
  border-color: rgba(244, 211, 94, 0.84);
  background: rgba(244, 211, 94, 0.105);
}

.signature-entry.active .seed-canvas {
  border-color: rgba(244, 211, 94, 0.58);
  background: rgba(244, 211, 94, 0.045);
}

.signature-entry b {
  display: block;
  grid-area: name;
  margin-bottom: 4px;
  color: var(--gold);
  font-size: 15px;
}

.signature-entry strong {
  display: block;
  grid-area: meta;
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.28;
}

.signature-entry .seed-canvas {
  grid-area: glyph;
  width: 100%;
  height: 78px;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.2);
}

.signature-entry span {
  grid-area: info;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.25;
}

.loading-entry {
  opacity: 0.72;
}

.engine-stage {
  position: relative;
  min-height: 660px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 38%),
    #0c0e12;
}

.signature-bank {
  position: absolute;
  z-index: 2;
  top: 24px;
  left: 24px;
  right: 24px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.signature-card {
  position: relative;
  min-height: 128px;
  overflow: hidden;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.signature-card strong {
  display: block;
  position: relative;
  z-index: 2;
  margin-bottom: 6px;
  font-size: 15px;
}

.signature-card canvas {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 74px;
}

.signature-card span {
  position: relative;
  z-index: 2;
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.collection-card {
  border-color: rgba(244, 211, 94, 0.42);
  background:
    linear-gradient(180deg, rgba(244, 211, 94, 0.08), rgba(255, 255, 255, 0.04)),
    rgba(255, 255, 255, 0.055);
}

.collection-card img {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.26;
  filter: saturate(0.8) contrast(1.08);
}

.collection-card::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  content: "";
  background:
    linear-gradient(180deg, rgba(12, 14, 18, 0.28), rgba(12, 14, 18, 0.74)),
    radial-gradient(circle at 70% 18%, rgba(244, 211, 94, 0.22), transparent 36%);
}

.flow-field {
  position: absolute;
  inset: 0 0 112px;
  width: 100%;
  height: calc(100% - 112px);
}

.score-rings circle {
  fill: none;
  stroke-width: 1.5;
  transform-origin: 600px 250px;
  animation: ringSpin 8s linear infinite;
}

.score-rings circle:nth-child(1) {
  stroke: rgba(120, 220, 232, 0.62);
  stroke-dasharray: 72 260;
}

.score-rings circle:nth-child(2) {
  stroke: rgba(244, 211, 94, 0.58);
  stroke-dasharray: 54 310;
  animation-duration: 10s;
  animation-direction: reverse;
}

.score-rings circle:nth-child(3) {
  stroke: rgba(142, 232, 164, 0.5);
  stroke-dasharray: 42 360;
  animation-duration: 12s;
}

.engine-core circle:first-child {
  fill: rgba(120, 220, 232, 0.11);
  stroke: rgba(120, 220, 232, 0.85);
  stroke-width: 2;
  transform-origin: 600px 250px;
  animation: breathe 2.8s ease-in-out infinite;
}

.engine-core circle:nth-child(2) {
  fill: rgba(244, 211, 94, 0.2);
  stroke: rgba(244, 211, 94, 0.8);
  stroke-width: 1.5;
}

.engine-core text {
  fill: var(--ink);
  font-size: 20px;
  font-weight: 800;
  text-anchor: middle;
}

.flow-line,
.output-line,
.context-flow {
  fill: none;
  stroke: url(#flowGradient);
  stroke-width: 2.5;
  stroke-linecap: round;
  opacity: 0.8;
  stroke-dasharray: 8 14;
  animation: dash 1.5s linear infinite;
}

.output-line {
  stroke-width: 3.5;
}

.context-flow {
  stroke-width: 2;
  opacity: 0.62;
  stroke-dasharray: 5 12;
}

.delay-1 {
  animation-delay: -0.7s;
}

.particle {
  fill: var(--gold);
  filter: url(#glow);
}

.p1 { offset-path: path("M126 115 C285 148 410 185 530 230"); animation: particleMove 2.4s linear infinite; }
.p2 { offset-path: path("M363 115 C455 150 520 185 570 218"); animation: particleMove 2.1s linear infinite -0.7s; fill: var(--cyan); }
.p3 { offset-path: path("M600 115 C600 150 600 188 600 218"); animation: particleMove 2.6s linear infinite -1.1s; fill: var(--rose); }
.p4 { offset-path: path("M837 115 C745 150 680 185 636 218"); animation: particleMove 2.3s linear infinite -0.35s; }
.p5 { offset-path: path("M600 334 C600 390 515 418 360 432 C230 444 165 467 160 498"); animation: particleMove 3s linear infinite -1.5s; fill: var(--green); }
.p6 { offset-path: path("M600 334 C610 385 675 414 800 431 C965 453 1040 468 1050 498"); animation: particleMove 3.2s linear infinite -0.4s; fill: var(--cyan); }
.p7 { offset-path: path("M1074 115 C915 148 790 185 670 230"); animation: particleMove 2.5s linear infinite -0.9s; fill: var(--gold); }

.engine-context {
  position: absolute;
  z-index: 3;
  top: 210px;
  width: 252px;
  min-height: 112px;
  padding: 12px;
  border: 1px solid rgba(120, 220, 232, 0.24);
  border-radius: 8px;
  background: rgba(10, 13, 18, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.engine-context strong {
  display: block;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 13px;
}

.signals-context {
  left: 46px;
  border-color: rgba(120, 220, 232, 0.34);
}

.profile-context {
  right: 46px;
  border-color: rgba(142, 232, 164, 0.34);
}

.signal-chips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.signal-chips span {
  min-width: 0;
  padding: 6px 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: rgba(246, 242, 232, 0.86);
  background: rgba(255, 255, 255, 0.045);
  font-size: 11px;
  text-align: center;
}

.signal-chips span:nth-child(1),
.signal-chips span:nth-child(5) {
  border-color: rgba(142, 232, 164, 0.42);
  color: var(--green);
}

.signal-chips span:nth-child(2) {
  border-color: rgba(255, 122, 144, 0.46);
  color: var(--rose);
}

.signal-chips span:nth-child(3),
.signal-chips span:nth-child(4) {
  border-color: rgba(120, 220, 232, 0.42);
  color: var(--cyan);
}

.signal-chips span:nth-child(6) {
  border-color: rgba(244, 211, 94, 0.42);
  color: var(--gold);
}

.profile-context canvas {
  width: 100%;
  height: 78px;
}

.profile-context span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.timeline-wrap {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 24px;
  height: 164px;
  border-top: 1px solid var(--line);
}

@keyframes orbit {
  to { transform: rotate(360deg); }
}

@keyframes breathe {
  50% { transform: scale(1.08); opacity: 0.72; }
}

@keyframes dash {
  to { stroke-dashoffset: -22; }
}

@keyframes ringSpin {
  to { transform: rotate(360deg); }
}

@keyframes particleMove {
  from { offset-distance: 0%; opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  to { offset-distance: 100%; opacity: 0; }
}

@media (max-width: 1100px) {
  .hero,
  .learning-grid {
    grid-template-columns: 1fr;
  }

  .hero-orbit {
    display: none;
  }

  .panel {
    min-height: 420px;
  }

  .signature-bank {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .engine-context {
    display: none;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 24px, 1480px);
    padding-top: 18px;
  }

  .module {
    padding: 16px;
  }

  .section-head,
  .technique-meta {
    align-items: start;
    flex-direction: column;
  }

  .stats {
    justify-content: start;
  }

  .signature-bank,
  .seed-list {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 820px) {
  body[data-embed] .learning-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body[data-embed] .signature-bank {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  body[data-embed] .engine-context {
    display: block;
  }
}

body[data-embed="learning"] .learning-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
