:root {
  --paper: #f4f1ea;
  --surface: #fffdf9;
  --ink: #191b22;
  --muted: #6f717b;
  --line: rgb(25 27 34 / 12%);
  --purple: #6655e8;
  --purple-dark: #302a72;
  --purple-soft: #eeeafd;
  --blue: #4a8ef0;
  --orange: #ff7657;
  --green: #1b9e71;
  --shadow: 0 26px 76px rgb(47 39 88 / 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 8% 2%, rgb(102 85 232 / 16%), transparent 31rem),
    radial-gradient(circle at 94% 4%, rgb(255 118 87 / 13%), transparent 29rem),
    linear-gradient(135deg, #f2f0f7 0%, var(--paper) 55%, #f5eee6 100%);
  overflow-x: hidden;
}

button {
  font: inherit;
  cursor: pointer;
}

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

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

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

.page > *,
.demo-shell,
.workspace,
.workspace > *,
.code-panel {
  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(--purple);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.eyebrow::before {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--purple);
  box-shadow: 4px 4px 0 var(--orange);
  content: "";
  transform: rotate(8deg);
}

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(--purple-dark);
  font-size: 0.92em;
}

.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(102 85 232 / 22%);
  border-radius: 999px;
  color: var(--purple-dark);
  background: var(--purple-soft);
  font-size: 12px;
  font-weight: 900;
}

.support-chip.is-unsupported {
  border-color: rgb(255 118 87 / 35%);
  color: #8c3d29;
  background: #ffebe5;
}

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

.flow-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(250px, 1.1fr) auto minmax(220px, 1fr);
  gap: 14px;
  align-items: center;
  padding: 17px 22px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 62%);
}

.flow-step,
.panel-heading,
.preview-heading,
.code-head,
.code-head > div,
.density-badge,
.token-row > span {
  display: flex;
  align-items: center;
}

.flow-step {
  gap: 11px;
  min-width: 0;
}

.flow-number {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  color: white;
  background: var(--purple);
  font-size: 10px;
  font-weight: 900;
}

.flow-step div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.flow-step small,
.panel-heading p,
.preview-heading p,
.code-head span {
  color: var(--purple);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.flow-step strong {
  overflow: hidden;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-arrow {
  color: rgb(102 85 232 / 46%);
  font-size: 24px;
  font-weight: 400;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.72fr) minmax(520px, 1.28fr);
  min-height: 480px;
}

.variables-panel,
.implementation-panel {
  padding: 24px;
}

.variables-panel {
  border-right: 1px solid var(--line);
  background:
    linear-gradient(rgb(102 85 232 / 3%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(102 85 232 / 3%) 1px, transparent 1px),
    #fbfaff;
  background-size: 20px 20px;
}

.implementation-panel {
  background: #f5f3f8;
}

.panel-heading {
  gap: 11px;
}

.panel-heading > div:nth-child(2) {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.panel-heading h2,
.preview-heading h2 {
  font-size: 18px;
  letter-spacing: -0.025em;
}

.panel-heading > span {
  margin-left: auto;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: white;
  font-size: 10px;
  font-weight: 800;
}

.figma-mark {
  display: grid;
  grid-template-columns: repeat(2, 10px);
  grid-template-rows: repeat(3, 10px);
  flex: 0 0 auto;
  width: 28px;
  height: 34px;
}

.figma-mark i {
  display: block;
}

.figma-mark i:nth-child(1) {
  border-radius: 7px 0 0 7px;
  background: #f24e1e;
}

.figma-mark i:nth-child(2) {
  border-radius: 0 7px 7px 0;
  background: #ff7262;
}

.figma-mark i:nth-child(3) {
  border-radius: 7px 0 0 7px;
  background: #a259ff;
}

.figma-mark i:nth-child(4) {
  border-radius: 50%;
  background: #1abcfe;
}

.figma-mark i:nth-child(5) {
  grid-column: 1;
  border-radius: 7px 0 7px 7px;
  background: #0acf83;
}

.mode-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 22px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgb(238 234 253 / 58%);
}

.mode-control button {
  display: grid;
  gap: 2px;
  min-height: 62px;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.mode-control button span {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.mode-control button small {
  font-size: 10px;
  font-weight: 700;
}

.mode-control button[aria-pressed="true"] {
  border-color: rgb(102 85 232 / 20%);
  color: var(--purple-dark);
  background: white;
  box-shadow: 0 8px 20px rgb(48 42 114 / 10%);
}

.token-table {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  overflow: hidden;
}

.token-head,
.token-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}

.token-head {
  padding: 10px 14px;
  color: var(--muted);
  background: #f5f3f8;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.token-row {
  min-height: 47px;
  padding: 0 14px;
  border-top: 1px solid var(--line);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.token-row > span {
  gap: 8px;
}

.token-row strong {
  color: var(--purple-dark);
  font-size: 11px;
}

.token-icon {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--purple);
  transform: rotate(45deg);
}

.variables-note {
  margin-top: 18px;
  padding: 14px;
  border-left: 3px solid var(--purple);
  border-radius: 4px 12px 12px 4px;
  color: var(--muted);
  background: rgb(238 234 253 / 65%);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.65;
}

.variables-note span {
  display: block;
  margin-bottom: 3px;
  color: var(--purple);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.preview-heading {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.preview-heading > div {
  display: grid;
  gap: 3px;
}

.density-badge {
  gap: 7px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgb(102 85 232 / 20%);
  border-radius: 999px;
  color: var(--purple-dark);
  background: var(--purple-soft);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.density-badge i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 0 0 4px rgb(102 85 232 / 12%);
}

.density-container {
  --density: cozy;
  container-name: density-preview;
  container-type: normal;
}

.preview-board {
  display: grid;
  gap: 14px;
  min-height: 370px;
  padding: 22px;
  border: 1px solid rgb(28 25 48 / 11%);
  border-radius: 20px;
  background:
    radial-gradient(circle at 90% 0%, rgb(102 85 232 / 16%), transparent 16rem),
    #252331;
  box-shadow: 0 18px 46px rgb(31 27 51 / 18%);
  transition:
    gap 280ms ease,
    padding 280ms ease;
}

.profile-card,
.activity-card,
.metric-card {
  border: 1px solid rgb(255 255 255 / 8%);
  background: rgb(255 255 255 / 96%);
  transition:
    gap 280ms ease,
    padding 280ms ease,
    min-height 280ms ease,
    border-radius 280ms ease;
}

.profile-card,
.activity-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: 16px;
}

.profile-card {
  min-height: 104px;
}

.activity-card {
  min-height: 88px;
}

.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  color: white;
  font-size: 12px;
  font-weight: 900;
  transition:
    width 280ms ease,
    height 280ms ease,
    border-radius 280ms ease;
}

.avatar--purple {
  background: linear-gradient(135deg, #8f7cf9, #5a47d6);
}

.avatar--orange {
  background: linear-gradient(135deg, #ff9d6d, #f06047);
}

.profile-copy,
.activity-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.profile-copy {
  margin-right: auto;
}

.profile-copy span,
.metric-card span {
  color: var(--purple);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.11em;
}

.profile-copy strong,
.activity-copy strong {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: font-size 280ms ease;
}

.profile-copy small,
.activity-copy span,
.activity-card time {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: font-size 280ms ease;
}

.profile-card > button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  color: white;
  background: var(--purple);
  font-size: 16px;
  transition:
    width 280ms ease,
    height 280ms ease,
    border-radius 280ms ease;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  transition: gap 280ms ease;
}

.metric-card {
  display: grid;
  gap: 2px;
  min-height: 112px;
  padding: 18px;
  border-radius: 16px;
}

.metric-card strong {
  font-size: 28px;
  line-height: 1.12;
  transition: font-size 280ms ease;
}

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

.metric-card small i {
  color: var(--green);
  font-style: normal;
}

.activity-copy {
  margin-right: auto;
}

.activity-card time {
  flex: 0 0 auto;
}

@container density-preview style(--density: compact) {
  .preview-board {
    gap: 8px;
    padding: 12px;
  }

  .profile-card,
  .activity-card {
    gap: 8px;
    padding: 10px 12px;
    border-radius: 11px;
  }

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

  .activity-card {
    min-height: 60px;
  }

  .avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .profile-copy strong,
  .activity-copy strong {
    font-size: 13px;
  }

  .profile-copy small,
  .activity-copy span,
  .activity-card time {
    font-size: 9px;
  }

  .profile-card > button {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }

  .metric-grid {
    gap: 8px;
  }

  .metric-card {
    min-height: 80px;
    padding: 10px 12px;
    border-radius: 11px;
  }

  .metric-card strong {
    font-size: 21px;
  }
}

@container density-preview style(--density: cozy) {
  .preview-board {
    gap: 14px;
    padding: 22px;
  }
}

.fallback-notice {
  margin-top: 10px;
  color: #91432f;
  font-size: 11px;
  font-weight: 800;
}

.code-panel {
  position: relative;
  border-top: 1px solid var(--line);
  background: #1f1d29;
}

.code-head {
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid rgb(255 255 255 / 8%);
}

.code-head > div {
  gap: 10px;
}

.code-head strong {
  padding: 4px 7px;
  border-radius: 6px;
  color: #c9c0ff;
  background: rgb(102 85 232 / 22%);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
}

.code-head button {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 8px;
  color: #f7f4ff;
  background: rgb(255 255 255 / 7%);
  font-size: 10px;
  font-weight: 900;
}

.code-panel pre {
  max-width: 100%;
  padding: 17px 20px 19px;
  overflow-x: auto;
  color: #f3f0ff;
  font-size: 12px;
  line-height: 1.7;
}

.code-panel code {
  white-space: pre;
}

.copy-status {
  position: absolute;
  right: 18px;
  bottom: 8px;
  color: #b8eddb;
  font-size: 9px;
  font-weight: 800;
}

.style-query-test {
  --sq-test: ready;
  container-type: normal;
  position: fixed;
  top: -100px;
  left: -100px;
}

@container style(--sq-test: ready) {
  .style-query-test span {
    --sq-supported: yes;
  }
}

@media (max-width: 900px) {
  .page {
    width: min(100% - 28px, 720px);
    padding-top: 22px;
  }

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

  .flow-bar {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .flow-arrow {
    display: none;
  }

  .flow-step {
    padding: 7px 0;
  }

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

  .variables-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 560px) {
  .page {
    width: calc(100% - 20px);
    padding: 16px 0 26px;
  }

  h1 {
    font-size: 31px;
    line-height: 1.14;
  }

  .lead {
    font-size: 13px;
    line-height: 1.6;
  }

  .demo-shell {
    border-radius: 18px;
  }

  .flow-bar,
  .variables-panel,
  .implementation-panel {
    padding: 16px;
  }

  .flow-number {
    width: 32px;
    height: 32px;
  }

  .mode-control button {
    min-height: 58px;
    padding: 8px;
  }

  .mode-control button small {
    font-size: 9px;
  }

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

  .preview-heading h2 {
    font-size: 16px;
  }

  .density-badge {
    min-height: 30px;
    padding: 0 9px;
  }

  .preview-board {
    min-height: 340px;
    padding: 14px;
  }

  .profile-card,
  .activity-card {
    gap: 10px;
    padding: 13px;
  }

  .avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .profile-copy strong,
  .activity-copy strong {
    font-size: 14px;
  }

  .metric-card {
    min-height: 98px;
    padding: 14px;
  }

  .metric-card strong {
    font-size: 24px;
  }

  .code-panel pre {
    padding: 15px 16px 18px;
    font-size: 10px;
  }
}

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

