:root {
  color-scheme: light;
  --ink: #153532;
  --muted: #57706d;
  --paper: #f7fbfa;
  --card: #ffffff;
  --line: #cfe3df;
  --brand: #2f9d8f;
  --brand-dark: #185b54;
  --brand-soft: #dff4f0;
  --purple: #7457c4;
  --purple-soft: #eee9fb;
  --yellow: #f4b942;
  --yellow-soft: #fff4d9;
  --red: #c9514d;
  --shadow: 0 18px 48px rgba(24, 91, 84, 0.11);
  --radius: 20px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  overflow-x: clip;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 5%, rgba(47, 157, 143, 0.13), transparent 24rem),
    linear-gradient(180deg, #fbfefd 0, var(--paper) 34rem);
  font-size: 16px;
  line-height: 1.7;
}

a {
  color: var(--brand-dark);
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--brand);
}

a:focus-visible {
  border-radius: 0.25rem;
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}

code {
  padding: 0.12em 0.38em;
  border-radius: 6px;
  color: #254a46;
  background: #e8f2f0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
}

.skip-link {
  position: absolute;
  top: -4rem;
  left: 1rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: 0 0 8px 8px;
  color: white;
  background: var(--brand-dark);
}

.skip-link:focus {
  top: 0;
}

.app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(207, 227, 223, 0.8);
  background: rgba(251, 254, 253, 0.9);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.app-bar-inner,
main,
.footer-inner {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.app-bar-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 4.25rem;
  align-items: center;
  gap: 1rem;
}

.app-bar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.app-bar-mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  flex: none;
  place-items: center;
  border-radius: 12px 12px 12px 4px;
  color: white;
  background: var(--brand);
  box-shadow: 0 7px 18px rgba(47, 157, 143, 0.27);
  font-weight: 900;
}

.app-bar-sections {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-width: 0;
  overflow: hidden;
  font-size: 0.92rem;
}

.app-bar-sections a {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.app-bar-sections a:hover {
  color: var(--ink);
}

.app-bar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  min-width: 0;
}

.app-bar-github {
  padding: 0.38rem 0.58rem;
  border-radius: 0.65rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.app-bar-github:hover {
  color: var(--ink);
  background: var(--brand-soft);
}

.app-bar-languages {
  display: inline-flex;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 99rem;
  background: var(--card);
}

.app-bar-languages a {
  padding: 0.26rem 0.6rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.app-bar-languages a:hover,
.app-bar-languages a[aria-current="page"] {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

main {
  padding-bottom: 6rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: clamp(2rem, 6vw, 5rem);
  min-height: 590px;
  align-items: center;
  padding: 5rem 0 4rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 1rem;
  color: var(--brand-dark);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 22px;
  height: 3px;
  border-radius: 999px;
  background: var(--brand);
  content: "";
}

h1,
h2,
h3 {
  line-height: 1.16;
  letter-spacing: -0.035em;
}

h1 {
  max-width: 13ch;
  margin: 0;
  font-size: clamp(3rem, 7vw, 5.7rem);
}

h2 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 4.5vw, 3.15rem);
}

h3 {
  margin: 0 0 0.75rem;
  font-size: 1.22rem;
}

.lead {
  max-width: 58ch;
  margin: 1.45rem 0 0;
  color: var(--muted);
  font-size: 1.15rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.65rem 1rem;
  border: 1px solid var(--brand-dark);
  border-radius: 12px;
  color: var(--brand-dark);
  font-weight: 800;
  text-decoration: none;
}

.button.primary {
  color: white;
  background: var(--brand-dark);
}

.button:hover {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.button.primary:hover {
  color: white;
  background: var(--brand);
}

.hero-visual {
  position: relative;
  min-height: 430px;
}

.stage-window {
  position: absolute;
  inset: 0 0 35px 0;
  overflow: hidden;
  border: 1px solid #bdd9d4;
  border-radius: 28px;
  background: #dff3ef;
  box-shadow: var(--shadow);
}

.window-bar {
  display: flex;
  gap: 7px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(47, 157, 143, 0.18);
  background: rgba(255, 255, 255, 0.56);
}

.window-bar i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line);
}

.stage {
  position: relative;
  height: calc(100% - 42px);
  overflow: hidden;
}

.stage::before,
.stage::after {
  position: absolute;
  border-radius: 50%;
  content: "";
}

.stage::before {
  width: 300px;
  height: 300px;
  right: -80px;
  bottom: -130px;
  background: rgba(255, 255, 255, 0.48);
}

.stage::after {
  width: 160px;
  height: 160px;
  top: 10px;
  left: -70px;
  border: 35px solid rgba(47, 157, 143, 0.1);
}

.sprite {
  position: absolute;
  top: 98px;
  left: 50%;
  z-index: 2;
  width: 116px;
  height: 116px;
  transform: translateX(-50%);
  border: 5px solid white;
  border-radius: 48% 52% 45% 55%;
  background: var(--yellow);
  box-shadow: 0 13px 30px rgba(48, 102, 94, 0.18);
}

.sprite::before,
.sprite::after {
  position: absolute;
  top: 36px;
  width: 11px;
  height: 17px;
  border-radius: 50%;
  background: var(--ink);
  content: "";
}

.sprite::before {
  left: 29px;
}

.sprite::after {
  right: 29px;
}

.smile {
  position: absolute;
  top: 61px;
  left: 50%;
  width: 34px;
  height: 17px;
  transform: translateX(-50%);
  border-bottom: 4px solid var(--ink);
  border-radius: 0 0 50% 50%;
}

.keycap {
  position: absolute;
  top: 28px;
  left: 25px;
  z-index: 4;
  min-width: 85px;
  padding: 0.7rem 0.9rem;
  border: 1px solid #cfd7d5;
  border-bottom-width: 5px;
  border-radius: 12px;
  color: #354e4b;
  background: white;
  box-shadow: 0 9px 20px rgba(24, 91, 84, 0.12);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-weight: 800;
  text-align: center;
}

.tap-ring {
  position: absolute;
  top: 150px;
  right: 35px;
  z-index: 3;
  width: 62px;
  height: 62px;
  border: 4px solid var(--red);
  border-radius: 50%;
  box-shadow: 0 0 0 10px rgba(201, 81, 77, 0.13);
}

.pose-chip {
  position: absolute;
  right: 22px;
  bottom: 32px;
  z-index: 4;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  color: #4a328b;
  background: var(--purple-soft);
  box-shadow: 0 8px 22px rgba(74, 50, 139, 0.12);
  font-size: 0.8rem;
  font-weight: 850;
}

.runtime-card {
  position: absolute;
  right: -18px;
  bottom: 0;
  z-index: 6;
  min-width: 245px;
  padding: 1rem 1.1rem;
  border: 1px solid #c9dedb;
  border-radius: 16px;
  background: white;
  box-shadow: 0 15px 35px rgba(24, 91, 84, 0.17);
}

.runtime-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.runtime-value {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.25rem;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-weight: 850;
}

.runtime-value strong {
  color: var(--brand);
  font-size: 1.35rem;
}

.section {
  padding: 5rem 0 1rem;
  scroll-margin-top: 5rem;
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 3rem;
  align-items: end;
  margin-bottom: 2rem;
}

.section-heading p {
  margin: 0 0 0.45rem;
  color: var(--muted);
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: setup-step;
}

.steps li {
  position: relative;
  min-height: 260px;
  padding: 1.4rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 8px 28px rgba(24, 91, 84, 0.06);
  counter-increment: setup-step;
}

.steps li::before {
  display: grid;
  width: 38px;
  height: 38px;
  margin-bottom: 1.4rem;
  place-items: center;
  border-radius: 12px;
  color: white;
  background: var(--brand);
  content: counter(setup-step, decimal-leading-zero);
  font-size: 0.8rem;
  font-weight: 900;
}

.steps h3 {
  font-size: 1.1rem;
}

.steps p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.flow-figure,
.ownership-figure,
.math-figure {
  margin: 2.5rem 0 0;
  padding: clamp(1.25rem, 4vw, 3rem);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.figure-kicker {
  display: block;
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.flow {
  display: grid;
  grid-template-columns: 1fr 38px 1fr 38px 1.15fr 38px 1fr;
  align-items: stretch;
}

.flow-node {
  display: flex;
  min-height: 155px;
  flex-direction: column;
  justify-content: center;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  text-align: center;
}

.flow-node.accent {
  border-color: #afd6cf;
  background: var(--brand-soft);
}

.flow-node.optional {
  border-style: dashed;
  border-color: #c7b8eb;
  background: var(--purple-soft);
}

.flow-icon {
  display: block;
  margin-bottom: 0.6rem;
  font-size: 1.8rem;
  line-height: 1;
}

.flow-node strong {
  line-height: 1.25;
}

.flow-node small {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  line-height: 1.4;
}

.arrow {
  display: grid;
  place-items: center;
  color: var(--brand);
  font-size: 1.5rem;
  font-weight: 900;
}

.figure-note {
  margin: 1.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

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

.example-card {
  display: flex;
  min-height: 340px;
  flex-direction: column;
  padding: 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.example-card.pose {
  border-color: #d8ceef;
}

.example-type {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
  padding: 0.27rem 0.58rem;
  border-radius: 999px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-size: 0.76rem;
  font-weight: 850;
}

.pose .example-type {
  color: #4a328b;
  background: var(--purple-soft);
}

.block-stack {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  margin: 1rem 0 1.2rem;
}

.scratch-block {
  width: fit-content;
  max-width: 100%;
  padding: 0.55rem 0.75rem;
  border-bottom: 3px solid var(--brand-dark);
  border-radius: 8px;
  color: white;
  background: var(--brand);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.45;
}

.scratch-block.event {
  border-color: #b28622;
  border-radius: 18px 8px 8px 8px;
  background: var(--yellow);
  color: #49370e;
}

.scratch-block.variable {
  border-color: #b46821;
  background: #ee9536;
}

.scratch-block.pose-block {
  border-color: #4f3890;
  background: var(--purple);
}

.slot {
  display: inline-block;
  margin: 0 0.08em;
  padding: 0.03em 0.36em;
  border-radius: 999px;
  color: var(--ink);
  background: white;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-weight: 700;
}

.example-card > p:last-child {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.9rem;
}

.callout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.8rem;
  margin: 1.5rem 0 0;
  padding: 1rem 1.1rem;
  border: 1px solid #efd796;
  border-radius: 14px;
  background: var(--yellow-soft);
}

.callout strong {
  display: block;
}

.callout p {
  margin: 0.15rem 0 0;
  color: #665328;
}

.ownership-map {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 80px minmax(0, 0.9fr);
  gap: 1rem;
  align-items: center;
}

.targets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
}

.target-card {
  min-height: 150px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  text-align: center;
}

.target-avatar {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 0.7rem;
  place-items: center;
  border-radius: 17px;
  color: white;
  background: var(--brand);
  font-size: 1.1rem;
  font-weight: 900;
}

.target-card:nth-child(2) .target-avatar {
  background: #45a99d;
}

.target-card:nth-child(3) .target-avatar {
  background: var(--purple);
}

.target-card strong,
.binding-card strong {
  display: block;
  line-height: 1.3;
}

.target-card small,
.binding-card small {
  color: var(--muted);
}

.many-arrow {
  color: var(--brand);
  font-size: 2.2rem;
  font-weight: 900;
  text-align: center;
}

.binding-list {
  display: grid;
  gap: 0.7rem;
}

.binding-card {
  padding: 0.9rem 1rem;
  border-left: 5px solid var(--brand);
  border-radius: 10px;
  background: var(--brand-soft);
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.info-card {
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.info-card ul,
.reference-card ul {
  margin: 0.75rem 0 0;
  padding-left: 1.2rem;
}

.info-card li + li,
.reference-card li + li {
  margin-top: 0.45rem;
}

.math-flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 1rem;
  align-items: center;
}

.math-node {
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  text-align: center;
}

.math-node strong {
  display: block;
  color: var(--brand-dark);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 1.5rem;
}

.math-op {
  color: var(--brand);
  font-size: 1.8rem;
  font-weight: 900;
}

.math-table {
  width: 100%;
  margin-top: 1.5rem;
  border-collapse: collapse;
}

.math-table th,
.math-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.math-table th {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.reference-card {
  padding: 1.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.reference-card.optional {
  border-color: #d8ceef;
  background: #fdfcff;
}

.reference-card li {
  color: var(--muted);
  font-size: 0.9rem;
}

.faq-list {
  display: grid;
  gap: 0.8rem;
}

details {
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

summary {
  cursor: pointer;
  font-weight: 800;
}

details p {
  margin: 0.75rem 0 0;
  color: var(--muted);
}

.site-footer {
  border-top: 1px solid var(--line);
  background: #eff7f5;
}

.footer-inner {
  display: flex;
  min-height: 120px;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-inner p {
  margin: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

@media (max-width: 900px) {
  .app-bar-sections {
    display: none;
  }

  .hero {
    grid-template-columns: 1fr;
    padding-top: 3.5rem;
  }

  .hero-visual {
    width: min(560px, 100%);
    margin: 0 auto;
  }

  .steps,
  .example-grid,
  .reference-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flow {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .flow-node {
    min-height: auto;
  }

  .arrow {
    min-height: 28px;
    transform: rotate(90deg);
  }

  .ownership-map {
    grid-template-columns: 1fr;
  }

  .many-arrow {
    transform: rotate(90deg);
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .app-bar-inner,
  main,
  .footer-inner {
    width: min(100% - 1.2rem, 1120px);
  }

  .app-bar-inner {
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 4.25rem;
    gap: 0.5rem;
  }

  .app-bar-label {
    display: none;
  }

  .app-bar-actions {
    grid-column: 2;
  }

  .app-bar-languages a {
    padding-inline: 0.5rem;
    font-size: 0.78rem;
  }

  .hero {
    min-height: auto;
  }

  h1 {
    font-size: clamp(2.75rem, 14vw, 4rem);
  }

  .hero-visual {
    min-height: 365px;
  }

  .stage-window {
    bottom: 28px;
  }

  .runtime-card {
    right: -5px;
    min-width: 210px;
  }

  .section {
    padding-top: 4rem;
  }

  .section-heading,
  .steps,
  .example-grid,
  .two-column,
  .reference-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .section-heading {
    gap: 0.25rem;
  }

  .steps li {
    min-height: auto;
  }

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

  .target-card {
    min-height: auto;
  }

  .math-flow {
    grid-template-columns: 1fr;
  }

  .math-op {
    transform: rotate(90deg);
    text-align: center;
  }

  .math-table {
    font-size: 0.86rem;
  }

  .math-table th,
  .math-table td {
    padding: 0.65rem 0.4rem;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media print {
  .app-bar,
  .hero-actions {
    display: none;
  }

  body {
    background: white;
  }

  .hero {
    min-height: auto;
    padding-top: 1rem;
  }

  .section {
    break-inside: avoid;
  }
}
