:root {
  --paper: #f2f0e8;
  --surface: #fffdf8;
  --ink: #17201d;
  --muted: #69716d;
  --line: rgb(23 32 29 / 12%);
  --blue: #3978f2;
  --blue-dark: #1c468f;
  --blue-soft: #e7eeff;
  --cyan: #35c6d0;
  --cyan-soft: #dcf7f6;
  --orange: #f39a45;
  --orange-soft: #ffead4;
  --rose: #df5c7f;
  --rose-soft: #ffe4ec;
  --green: #18a678;
  --green-soft: #ddf5eb;
  --yellow: #ffd84d;
  --code: #17231f;
  --shadow: 0 26px 74px rgb(40 51 46 / 13%);
  color-scheme: light;
  font-family: "Avenir Next", "Hiragino Sans", "Yu Gothic", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 6% 2%, rgb(57 120 242 / 16%), transparent 31rem),
    radial-gradient(circle at 96% 3%, rgb(53 198 208 / 16%), transparent 28rem),
    linear-gradient(135deg, #eef3f4 0%, var(--paper) 54%, #f2ecdf 100%);
  overflow-x: hidden;
}

button {
  font: inherit;
  cursor: pointer;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

h1,
h2,
h3,
p,
pre {
  margin: 0;
}

.page {
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
  padding: 32px 0 44px;
}

.page > *,
.demo-shell,
.comparison-grid,
.comparison-grid > *,
.project-list,
.code-section {
  min-width: 0;
  max-width: 100%;
}

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

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.eyebrow::before {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgb(57 120 242 / 14%);
  content: "";
}

h1 {
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.08;
}

.lead {
  margin-top: 10px;
  color: var(--muted);
  font-size: clamp(15px, 1.55vw, 18px);
  font-weight: 800;
  line-height: 1.65;
}

.lead code {
  color: var(--blue-dark);
  font-size: 0.9em;
}

.support-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid rgb(57 120 242 / 24%);
  border-radius: 999px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 900;
}

.support-chip.is-unsupported {
  border-color: rgb(223 92 127 / 34%);
  color: #8d3852;
  background: var(--rose-soft);
}

.demo-shell {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgb(255 253 248 / 88%);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.control-bar {
  display: grid;
  grid-template-columns: minmax(205px, 0.72fr) minmax(520px, 1.7fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 68%);
}

.control-heading,
.control-heading > div,
.sort-buttons,
.section-heading,
.mode-chip,
.panel-heading,
.behavior-label,
.panel-foot,
.code-head,
.code-head > div:first-child,
.code-actions,
.code-tabs {
  display: flex;
  align-items: center;
}

.control-heading {
  gap: 12px;
}

.control-heading > div,
.code-head > div:first-child > div {
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
}

.step-number {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: white;
  background: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.step-number--dark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: var(--code);
  background: var(--cyan);
}

.control-heading p,
.section-heading p,
.code-head p {
  color: var(--blue);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.control-heading h2,
.section-heading h2,
.code-head h2 {
  font-size: 18px;
  letter-spacing: -0.025em;
}

.sort-buttons {
  gap: 8px;
}

.sort-buttons button {
  display: flex;
  align-items: flex-start;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 52px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--muted);
  background: white;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.sort-buttons button:hover {
  transform: translateY(-2px);
}

.sort-buttons button[aria-pressed="true"] {
  border-color: var(--blue);
  color: white;
  background: var(--blue);
  box-shadow: 0 9px 24px rgb(57 120 242 / 24%);
}

.sort-buttons span {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.sort-buttons small {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 800;
  opacity: 0.72;
}

.replay-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgb(57 120 242 / 25%);
  border-radius: 12px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.replay-button svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.comparison-section {
  padding: 20px;
}

.section-heading {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.mode-chip {
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgb(57 120 242 / 18%);
  border-radius: 999px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-size: 10px;
}

.mode-chip i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
}

.mode-chip b {
  letter-spacing: 0.08em;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.comparison-panel {
  min-height: 346px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: rgb(255 255 255 / 70%);
}

.comparison-panel--with {
  border-color: rgb(57 120 242 / 27%);
  background: linear-gradient(135deg, rgb(231 238 255 / 78%), rgb(255 255 255 / 82%));
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 75%);
}

.panel-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.panel-heading span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.comparison-panel--with .panel-heading span {
  color: var(--blue);
}

.panel-heading h3 {
  margin-top: 2px;
  font-size: 17px;
}

.behavior-label {
  gap: 6px;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 9px;
  letter-spacing: 0.08em;
}

.behavior-label i {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: currentColor;
}

.behavior-label--instant {
  color: #8d3852;
  background: var(--rose-soft);
}

.behavior-label--smooth {
  color: var(--blue-dark);
  background: var(--blue-soft);
}

.project-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.project-card {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 80px;
  padding: 10px;
  border: 1px solid rgb(23 32 29 / 10%);
  border-radius: 13px;
  background: white;
  box-shadow: 0 8px 22px rgb(39 52 46 / 7%);
}

.project-list--with .project-card {
  view-transition-name: match-element;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: var(--card-ink);
  background: var(--card-soft);
  font-size: 16px;
  font-style: normal;
  font-weight: 900;
}

.project-card--orbit {
  --card-ink: var(--blue);
  --card-soft: var(--blue-soft);
}

.project-card--form {
  --card-ink: var(--rose);
  --card-soft: var(--rose-soft);
}

.project-card--aurora {
  --card-ink: #d9771a;
  --card-soft: var(--orange-soft);
}

.project-card--motion {
  --card-ink: #0b8c93;
  --card-soft: var(--cyan-soft);
}

.card-copy {
  min-width: 0;
}

.card-copy span {
  display: block;
  color: var(--card-ink);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.card-copy h4 {
  margin: 3px 0 0;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 3px;
}

.card-meta b {
  font-size: 12px;
}

.card-meta small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
}

.rank-badge {
  position: absolute;
  top: -5px;
  left: -5px;
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border: 2px solid white;
  border-radius: 50%;
  color: white;
  background: var(--ink);
  font-size: 8px;
  font-style: normal;
  font-weight: 900;
}

.panel-foot {
  justify-content: space-between;
  gap: 10px;
  margin-top: 11px;
  padding: 9px 2px 0;
  border-top: 1px dashed rgb(23 32 29 / 13%);
}

.panel-foot code {
  overflow: hidden;
  color: var(--blue-dark);
  font-size: 9px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-foot span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.transition-status {
  min-height: 20px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.transition-status.is-active {
  color: var(--blue);
}

.code-section {
  padding: 18px 20px 20px;
  color: white;
  background: var(--code);
}

.code-head {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 13px;
}

.code-head > div:first-child {
  gap: 11px;
}

.code-head p {
  color: var(--cyan);
}

.code-head h2 {
  color: white;
}

.code-actions {
  gap: 10px;
}

.code-tabs {
  gap: 4px;
  padding: 3px;
  border: 1px solid rgb(255 255 255 / 13%);
  border-radius: 10px;
  background: rgb(255 255 255 / 6%);
}

.code-tabs button,
.copy-button {
  border: 0;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 900;
}

.code-tabs button {
  min-height: 30px;
  padding: 0 10px;
  color: rgb(255 255 255 / 58%);
  background: transparent;
}

.code-tabs button[aria-selected="true"] {
  color: var(--code);
  background: var(--cyan);
}

.copy-button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--code);
  background: white;
}

pre {
  min-height: 104px;
  padding: 14px 16px;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 13px;
  color: #d7f7eb;
  background: #101916;
  font-size: 12px;
  line-height: 1.55;
  overflow: auto;
  white-space: pre-wrap;
}

.copy-status {
  min-height: 14px;
  margin-top: 7px;
  color: var(--cyan);
  font-size: 9px;
}

.fallback-notice {
  margin-top: 14px;
  padding: 12px 15px;
  border: 1px solid rgb(223 92 127 / 25%);
  border-radius: 12px;
  color: #8d3852;
  background: var(--rose-soft);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-group(*) {
  animation-duration: 650ms;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (max-width: 980px) {
  .control-bar {
    grid-template-columns: 1fr auto;
  }

  .sort-buttons {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .replay-button {
    grid-column: 2;
    grid-row: 1;
  }

  .project-list {
    grid-template-columns: 1fr;
  }

  .comparison-panel {
    min-height: 490px;
  }
}

@media (max-width: 700px) {
  .page {
    width: min(100% - 24px, 560px);
    padding: 20px 0 28px;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 13px;
  }

  h1 {
    font-size: 31px;
  }

  .lead {
    font-size: 14px;
  }

  .support-chip {
    min-height: 36px;
  }

  .control-bar,
  .comparison-section,
  .code-section {
    padding: 14px;
  }

  .control-bar {
    gap: 12px;
  }

  .sort-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sort-buttons button {
    padding-inline: 9px;
  }

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

  .comparison-panel {
    min-height: 0;
  }

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

  .section-heading {
    align-items: flex-start;
  }

  .section-heading h2 {
    max-width: 210px;
  }

  .panel-foot {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .code-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .code-actions {
    width: 100%;
    justify-content: space-between;
  }

  pre {
    font-size: 10px;
  }
}

@media (max-width: 430px) {
  .control-heading h2,
  .section-heading h2,
  .code-head h2 {
    font-size: 16px;
  }

  .replay-button {
    width: 42px;
    padding: 0;
    font-size: 0;
  }

  .sort-buttons span {
    font-size: 9px;
  }

  .sort-buttons small {
    font-size: 8px;
  }

  .project-list {
    grid-template-columns: 1fr;
  }

  .project-card {
    min-height: 72px;
  }

  .mode-chip {
    padding-inline: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  ::view-transition-group(*) {
    animation-duration: 0.01ms;
  }
}
