/* ============================================================
   Button State Builder — 按钮状态构建器
   hero + 构建器面板 + 状态库 + 代码导出，一个完整的迷你应用。

   本地化说明：样式是从原稿搬过来的，除了在开头补了两段 @font-face
   （DM Sans 可变字体 + DM Mono），没有其它改动——原稿的字体是页面模板
   里带的，样式表本身没有 @import。
   ============================================================ */

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("../assets/dm-sans-var.woff2") format("woff2");
}

@font-face {
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/dm-mono-400.woff2") format("woff2");
}

@font-face {
  font-family: "DM Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/dm-mono-500.woff2") format("woff2");
}

html {
  scroll-behavior: smooth;
}
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

:root {
  --lime: #bfff00;
  --green: #09c12a;
  --orange: #ff6c2f;
  --pink: #e0307a;
  --blue: #2979ff;
  --black: #111111;
  --purple: #7c3aed;
  --page: #f0f0f0;
  --panel: #ffffff;
  --border: #e0e0e0;
  --muted: #999;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: "DM Sans", sans-serif;
  background: #e8e8e8;
  min-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  color: var(--black);
}

/* ── HERO SECTION ── */
.hero-section {
  position: relative;
  min-height: 0;
  background: linear-gradient(180deg, #ffffff 0%, #eef0f5 100%);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px 64px;
  overflow: hidden;
}
.hero-bg-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
      rgba(17, 17, 17, 0.035) 1px,
      transparent 1px
    ),
    linear-gradient(90deg, rgba(17, 17, 17, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(
    ellipse 80% 60% at 50% 50%,
    black 40%,
    transparent 100%
  );
}
.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 700px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.hero-eyebrow {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--green);
}
.hero-headline {
  font-size: clamp(36px, 7vw, 68px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--black);
}
.hero-gradient {
  background: linear-gradient(135deg, #86b800 0%, #09c12a 50%, #2979ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 17px;
  line-height: 1.6;
  color: rgba(17, 17, 17, 0.6);
  max-width: 480px;
}
.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.hero-chip {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(41, 121, 255, 0.25);
  color: #1b5fd6;
  background: rgba(41, 121, 255, 0.06);
  letter-spacing: 0.03em;
}
.hero-cta-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}
.hero-cta-btn {
  display: inline-block;
  background: var(--lime);
  color: #111;
  font-family: "DM Sans", sans-serif;
  font-size: 15px;
  font-weight: 700;
  padding: 13px 32px;
  border-radius: 999px;
  text-decoration: none;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 24px rgba(191, 255, 0, 0.45);
  transition: transform 0.2s, box-shadow 0.2s;
}
.hero-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(191, 255, 0, 0.6);
}
.hero-secondary-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: rgba(17, 17, 17, 0.5);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
}
.hero-secondary-btn:hover {
  color: var(--black);
}
.hero-cta-hint {
  font-size: 13px;
  color: rgba(17, 17, 17, 0.45);
  margin-top: 10px;
  max-width: 380px;
  align-self: center;
}
.hero-showcase {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex-wrap: wrap;
  gap: 40px 48px;
  margin-top: 64px;
  max-width: 980px;
  width: 100%;
}
.hshow-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.hshow-tilt-l {
  transform: rotate(-7deg) translateY(14px);
}
.hshow-tilt-c {
  transform: rotate(2deg) translateY(-10px) scale(1.08);
}
.hshow-tilt-r {
  transform: rotate(6deg) translateY(20px);
}
.hshow-card:hover {
  transform: rotate(0deg) translateY(-6px) scale(1.05);
  z-index: 5;
}
.hshow-tilt-c:hover {
  transform: rotate(0deg) translateY(-14px) scale(1.12);
}
.hshow-featured {
  position: relative;
  padding: 14px 10px 10px;
  border-radius: 18px;
  background: rgba(191, 255, 0, 0.08);
  border: 1.5px dashed rgba(191, 255, 0, 0.5);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.hshow-featured:hover {
  background: rgba(191, 255, 0, 0.16);
  border-color: rgba(191, 255, 0, 0.85);
}
.hshow-tag {
  font-family: "DM Mono", monospace;
  font-size: 10px;
  font-weight: 600;
  color: #6a8f00;
  background: var(--lime);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.hshow-edit-btn {
  display: inline-block;
  font-family: "DM Sans", sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #111;
  background: var(--lime);
  padding: 7px 14px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(191, 255, 0, 0.45);
  transition: transform 0.15s, box-shadow 0.15s;
}
.hshow-edit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(191, 255, 0, 0.6);
}
.hshow-stage {
  width: 190px;
  max-width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}
.hero-scroll-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.3);
  text-decoration: none;
  animation: hero-bob 2s ease-in-out infinite;
  transition: color 0.2s;
}
.hero-scroll-hint:hover {
  color: rgba(255, 255, 255, 0.7);
}
@keyframes hero-bob {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(6px);
  }
}

/* ── FEATURES SECTION ── */
.feat-section {
  background: #0e1024;
  padding: 100px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.feat-container {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}
.feat-eyebrow {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--lime);
  opacity: 0.7;
  margin-bottom: 18px;
}
.feat-headline {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: #fff;
  margin-bottom: 56px;
}
.feat-hl {
  background: linear-gradient(
    135deg,
    var(--lime) 0%,
    #09c12a 60%,
    #2979ff 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.feat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  text-align: left;
}
.feat-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 28px;
  transition: border-color 0.2s, background 0.2s;
}
.feat-card:hover {
  border-color: rgba(191, 255, 0, 0.25);
  background: rgba(191, 255, 0, 0.04);
}
.feat-icon {
  font-size: 28px;
  margin-bottom: 14px;
}
.feat-card h3 {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.feat-card p {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.45);
}

/* ── HOW IT WORKS ── */
.how-section {
  background: #0b0d1e;
  padding: 100px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.how-container {
  max-width: 780px;
  margin: 0 auto;
}
.how-eyebrow {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--lime);
  opacity: 0.7;
  margin-bottom: 18px;
  text-align: center;
}
.how-headline {
  font-size: clamp(26px, 4.5vw, 42px);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #fff;
  text-align: center;
  margin-bottom: 60px;
}
.how-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.how-step {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  padding: 36px 0;
}
.how-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.07);
}
.how-num {
  font-family: "DM Mono", monospace;
  font-size: 42px;
  font-weight: 500;
  color: rgba(191, 255, 0, 0.15);
  line-height: 1;
  min-width: 64px;
  padding-top: 4px;
}
.how-body h3 {
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 10px;
  letter-spacing: -0.015em;
}
.how-body p {
  font-size: 15px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.45);
}

/* ── PRE-BUILDER CTA ── */
.pre-cta-section {
  position: relative;
  background: #0b0d1e;
  padding: 100px 24px 120px;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.pre-cta-bg-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
      rgba(191, 255, 0, 0.04) 1px,
      transparent 1px
    ),
    linear-gradient(90deg, rgba(191, 255, 0, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(
    ellipse 70% 70% at 50% 50%,
    black 30%,
    transparent 100%
  );
}
.pre-cta-inner {
  position: relative;
  z-index: 2;
  max-width: 560px;
  margin: 0 auto;
}
.pre-cta-headline {
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
  margin-bottom: 16px;
}
.pre-cta-sub {
  font-size: 17px;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.5;
  margin-bottom: 36px;
}
.pre-cta-btn {
  display: inline-block;
  background: var(--lime);
  color: #111;
  font-family: "DM Sans", sans-serif;
  font-size: 16px;
  font-weight: 700;
  padding: 15px 36px;
  border-radius: 999px;
  text-decoration: none;
  letter-spacing: 0.01em;
  box-shadow: 0 0 48px rgba(191, 255, 0, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  margin-bottom: 28px;
}
.pre-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 68px rgba(191, 255, 0, 0.6);
}
.pre-cta-tags {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.pre-cta-tag {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.4);
}

/* ── FOOTER ── */
.site-footer {
  background: #080b18;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 32px 24px;
}
.site-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.site-footer-brand {
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: -0.01em;
}
.site-footer-links {
  display: flex;
  gap: 20px;
  align-items: center;
}
.site-footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.4);
  text-decoration: none;
  transition: color 0.2s;
}
.site-footer-links a:hover {
  color: rgba(255, 255, 255, 0.8);
}
.site-footer-copy {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 0.02em;
}

/* ── APP WRAPPER (builder section) ── */
#builder {
  scroll-margin-top: 48px;
}
.app-section {
  height: calc(100vh - 48px);
  overflow: hidden;
}

/* ── HEADER ── */
header {
  position: sticky;
  top: 0;
  height: 48px;
  background: var(--black);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid #333;
  z-index: 200;
}
header h1 {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.6;
}
.header-right {
  display: flex;
  gap: 8px;
  align-items: center;
}
.header-badge {
  font-family: "DM Mono", monospace;
  font-size: 10px;
  background: var(--lime);
  color: var(--black);
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
}
.editor-toggle {
  background: var(--lime);
  color: var(--black);
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 9px 20px;
  transition: all 0.2s;
  box-shadow: 0 2px 12px rgba(191, 255, 0, 0.35);
  letter-spacing: 0.01em;
}
.editor-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(191, 255, 0, 0.5);
}
.editor-toggle.active {
  background: var(--black);
  color: var(--lime);
  box-shadow: none;
}

/* ── APP BODY ── */
.app-body {
  display: flex;
  overflow: hidden;
  height: 100%;
}

/* ── EXAMPLES MAIN ── */
.examples-main {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  min-width: 120px;
}
.examples-main.hidden {
  display: none;
}

.ex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
}

/* ── EXAMPLE CARD ── */
.ex-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.ex-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.09);
  transform: translateY(-1px);
}
.ex-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ex-cat {
  font-family: "DM Mono", monospace;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.ex-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.ex-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 1px;
}

.ex-stage {
  background: #ebebeb;
  border-radius: 12px;
  padding: 24px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  border: 1px solid #dcdcdc;
}

.ex-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ex-edit-btn {
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}
.ex-edit-btn:hover {
  border-color: var(--black);
  color: var(--black);
  background: var(--black);
  color: white;
}

/* ── ANIMATED BUTTONS (examples) ── */
.sb {
  position: relative;
  height: 48px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: width 0.52s var(--spring), transform 0.2s var(--spring),
    box-shadow 0.3s ease;
  outline: none;
  color: white;
  width: 100%;
  min-width: 120px;
}
.sb-bg {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.38s ease;
}
.sb-cl {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.sb-cl.out {
  opacity: 0 !important;
  transform: scale(0.82) !important;
}
.sb-cl.in {
  transition: opacity 0.22s ease, transform 0.22s var(--spring);
}
.sb-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  pointer-events: none;
}
.sb.icon-right .sb-inner {
  flex-direction: row-reverse;
}
.sb-label {
  white-space: nowrap;
}
.sb-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sb-icon-wrap svg {
  display: block;
}
.sb-dots {
  display: none;
  align-items: center;
  gap: 5px;
}
.sb-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
  animation: sdot 1.1s ease-in-out infinite;
}
.sb-dots span:nth-child(2) {
  animation-delay: 0.18s;
}
.sb-dots span:nth-child(3) {
  animation-delay: 0.36s;
}
@keyframes sdot {
  0%,
  80%,
  100% {
    transform: scale(1);
    opacity: 0.4;
  }
  40% {
    transform: scale(1.5);
    opacity: 1;
  }
}
.sb-check {
  display: none;
  align-items: center;
  justify-content: center;
}
.sb-check svg path {
  fill: none;
  stroke: white;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
}
.sb.check-drawn .sb-check svg path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.45s var(--ease);
}
.sb-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: white;
  border-radius: 50%;
  animation: ssp 0.75s linear infinite;
}
@keyframes ssp {
  to {
    transform: rotate(360deg);
  }
}
.sb.hover-scale:hover {
  transform: scale(1.04);
}
.sb.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.sb.hover-bright:hover {
  filter: brightness(1.15);
}
.sb.hover-ring:hover {
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.3);
}
@keyframes sgrad {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* icon anims (shared) */
.icon-anim-spin {
  animation: ia-spin 1s linear infinite;
}
.icon-anim-spin-slow {
  animation: ia-spin 2s linear infinite;
}
.icon-anim-spin-fast {
  animation: ia-spin 0.5s linear infinite;
}
.icon-anim-pulse {
  animation: ia-pulse 1.2s ease-in-out infinite;
}
.icon-anim-pulse-slow {
  animation: ia-pulse 2s ease-in-out infinite;
}
.icon-anim-pulse-fast {
  animation: ia-pulse 0.7s ease-in-out infinite;
}
.icon-anim-bounce {
  animation: ia-bounce 1s var(--spring) infinite;
}
.icon-anim-bounce-slow {
  animation: ia-bounce 1.8s var(--spring) infinite;
}
.icon-anim-bounce-fast {
  animation: ia-bounce 0.6s var(--spring) infinite;
}
.icon-anim-shake {
  animation: ia-shake 0.5s ease-in-out infinite;
}
.icon-anim-shake-slow {
  animation: ia-shake 1s ease-in-out infinite;
}
.icon-anim-shake-fast {
  animation: ia-shake 0.3s ease-in-out infinite;
}
.icon-anim-wiggle {
  animation: ia-wiggle 1s ease-in-out infinite;
}
.icon-anim-wiggle-slow {
  animation: ia-wiggle 2s ease-in-out infinite;
}
.icon-anim-float {
  animation: ia-float 2s ease-in-out infinite;
}
.icon-anim-float-slow {
  animation: ia-float 3s ease-in-out infinite;
}
.icon-anim-float-fast {
  animation: ia-float 1.2s ease-in-out infinite;
}
@keyframes ia-spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes ia-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.35);
    opacity: 0.7;
  }
}
@keyframes ia-bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}
@keyframes ia-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}
@keyframes ia-wiggle {
  0%,
  100% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(-12deg);
  }
  75% {
    transform: rotate(12deg);
  }
}
@keyframes ia-float {
  0%,
  100% {
    transform: translateY(0) rotate(0);
  }
  50% {
    transform: translateY(-4px) rotate(5deg);
  }
}

/* state track */
.state-track {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.state-track::-webkit-scrollbar {
  display: none;
}
.st-node {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.st-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 500;
  border: 1.5px solid var(--border);
  color: var(--muted);
  transition: all 0.3s ease;
  white-space: nowrap;
  font-family: "DM Mono", monospace;
}
.st-pill.active {
  color: #111;
  border-color: #999;
}
.st-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  transition: background 0.3s;
  flex-shrink: 0;
}
.st-pill.active .st-dot {
  background: #111;
}
.st-arrow {
  font-size: 9px;
  color: #ccc;
  padding: 0 3px;
  flex-shrink: 0;
}

/* ── BUILDER STAGE ── */
/* Positioning context: examples-main sits in normal flow, the builder panel
   is absolutely positioned over it so it can slide in from the right edge
   without a width/reflow animation. */
.builder-stage {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  background: var(--panel);
}
.builder-stage .examples-main {
  width: 100%;
  height: 100%;
}

/* ── BUILDER PANEL (state edit + states + state view, unified window) ── */
/* Distinct motion signature from .state-info-panel: this one slides in as a
   whole from the right (translateX + spring), then its header/body settle
   in with a slight staggered fade — a drawer, not a width/opacity ease. */
.builder-panel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: -16px 0 40px rgba(0, 0, 0, 0.14);
  overflow: hidden;
  transform: translateX(0);
  transition: transform 0.48s var(--spring), box-shadow 0.3s ease;
  z-index: 5;
}
.builder-panel.hidden {
  transform: translateX(100%);
  box-shadow: none;
  pointer-events: none;
}
.builder-panel-header,
.builder-panel-body {
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.26s var(--ease), transform 0.3s var(--spring);
}
.builder-panel-header {
  transition-delay: 0.1s;
}
.builder-panel-body {
  transition-delay: 0.16s;
}
.builder-panel.hidden .builder-panel-header,
.builder-panel.hidden .builder-panel-body {
  opacity: 0;
  transform: translateX(16px);
  transition-delay: 0s;
}
.builder-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--panel);
}
.builder-panel-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.builder-panel-sublabel {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.builder-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.builder-panel-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* ── EDITOR PANEL (state edit column) ── */
.editor-panel {
  width: 360px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ── STATE GALLERY (state view + states column) ── */
.state-gallery {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.gallery-view-label {
  margin-top: 0;
}
.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.gallery-header h2 {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.gallery-play-btn {
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--black);
  color: white;
  border: none;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  letter-spacing: 0.03em;
}
.gallery-play-btn:hover {
  opacity: 0.82;
}
.gallery-play-btn.playing {
  background: var(--orange);
}
.live-preview-bg {
  background: #ebebeb;
  border-radius: 14px;
  padding: 28px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid #dcdcdc;
  flex-shrink: 0;
}
.live-preview-bg #preview-btn {
  max-width: 320px;
}
.gallery-subheader {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}
.gallery-subheader-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.gallery-subheader-row .gallery-subheader {
  margin-top: 0;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

/* ── GALLERY CELL — clickable to select state for editing ── */
.gallery-cell {
  background: #ebebeb;
  border-radius: 12px;
  padding: 18px 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border: 1.5px solid #dcdcdc;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
  cursor: pointer;
  position: relative;
}
.gallery-cell:hover {
  border-color: #aaa;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}
/* Active (being played/previewed) */
.gallery-cell.active-step {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(41, 121, 255, 0.15);
}
/* Selected for editing */
.gallery-cell.editing-state {
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12);
}
/* Both at once */
.gallery-cell.editing-state.active-step {
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.15), inset 0 0 0 1.5px var(--blue);
}

.gallery-cell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 6px;
  min-width: 120px;
}
.gallery-cell-label {
  font-family: "DM Mono", monospace;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.gallery-cell-edit-badge {
  font-family: "DM Mono", monospace;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--black);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.gallery-cell.editing-state .gallery-cell-edit-badge {
  opacity: 1;
}
.gallery-del-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #666;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  opacity: 0.45;
  transition: opacity 0.15s, background 0.15s, transform 0.1s;
}
.gallery-cell:hover .gallery-del-btn {
  opacity: 1;
}
.gallery-del-btn:hover {
  background: rgba(200, 0, 0, 0.15);
  color: #c00;
  transform: scale(1.1);
}
.gallery-del-btn:active {
  transform: scale(0.95);
}
.gallery-dup-btn:hover {
  background: rgba(41, 121, 255, 0.15) !important;
  color: #2979ff !important;
}
.gallery-cell.gallery-dragging {
  opacity: 0.35;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.gallery-cell.gallery-drag-over {
  outline: 3px solid var(--accent, #6c63ff);
  outline-offset: 3px;
  background: rgba(108, 99, 255, 0.06);
}
.gallery-drag-handle {
  display: grid;
  grid-template-columns: repeat(3, 4px);
  grid-template-rows: repeat(2, 4px);
  gap: 3px;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 18px;
  margin-bottom: 6px;
  cursor: grab;
  user-select: none;
}
.gallery-drag-handle span {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ccc;
  transition: background 0.15s;
}
.gallery-cell:hover .gallery-drag-handle span {
  background: #999;
}
.gallery-cell.gallery-dragging .gallery-drag-handle {
  cursor: grabbing;
}
.gallery-add-cell {
  background: transparent;
  border-radius: 12px;
  padding: 18px 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1.5px dashed #dcdcdc;
  cursor: pointer;
  min-height: 120px;
  transition: border-color 0.2s, background 0.2s;
  font-family: "DM Sans", sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
.gallery-add-cell:hover {
  border-color: var(--black);
  background: rgba(0, 0, 0, 0.02);
  color: var(--black);
}

/* Edit hint tooltip */
.gallery-cell::after {
  content: "Click to edit";
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--black);
  color: white;
  font-family: "DM Mono", monospace;
  font-size: 9px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.gallery-cell:hover:not(.editing-state)::after {
  opacity: 1;
}

.editor-header {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.editor-header h2 {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.editor-close {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #666;
  transition: all 0.15s;
}
.editor-close:hover {
  background: #ccc;
}

.proto-btn {
  position: relative;
  height: 48px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-family: "DM Sans", sans-serif;
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: width 0.52s var(--spring), transform 0.2s var(--spring),
    box-shadow 0.3s ease;
  outline: none;
  color: white;
  width: 100%;
}
#btn-bg-layer {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.38s ease;
}
#btn-content-layer {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
#btn-content-layer.out {
  opacity: 0 !important;
  transform: scale(0.82) !important;
}
#btn-content-layer.in {
  transition: opacity 0.22s ease, transform 0.22s var(--spring);
}
.proto-btn .btn-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
  position: relative;
}
.proto-btn.icon-right .btn-inner {
  flex-direction: row-reverse;
}
.proto-btn.icon-above .btn-inner {
  flex-direction: column;
  gap: 4px;
}
.proto-btn .btn-label {
  white-space: nowrap;
}
.btn-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.btn-icon-wrap svg {
  display: block;
}
.proto-btn .btn-dots {
  display: none;
  align-items: center;
  gap: 6px;
}
.proto-btn .btn-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
  animation: dot-pulse 1.1s ease-in-out infinite;
}
.proto-btn .btn-dots span:nth-child(2) {
  animation-delay: 0.18s;
}
.proto-btn .btn-dots span:nth-child(3) {
  animation-delay: 0.36s;
}
@keyframes dot-pulse {
  0%,
  80%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }
  40% {
    transform: scale(1.5);
    opacity: 1;
  }
}
.proto-btn .btn-check {
  display: none;
  align-items: center;
  justify-content: center;
}
.proto-btn .btn-check svg path {
  fill: none;
  stroke: white;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
}
.proto-btn.check-drawn .btn-check svg path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.45s var(--ease);
}
.proto-btn .btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.proto-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 80%;
  height: 100%;
  background: linear-gradient(
    105deg,
    transparent 20%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 80%
  );
  pointer-events: none;
}
.proto-btn.shimmer::after {
  animation: shimmer 0.55s ease forwards;
}
@keyframes shimmer {
  to {
    left: 140%;
  }
}
.proto-btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  width: 10px;
  height: 10px;
  transform: scale(0);
  opacity: 1;
  animation: ripple-out 0.5s ease-out forwards;
  pointer-events: none;
}
@keyframes ripple-out {
  to {
    transform: scale(14);
    opacity: 0;
  }
}
.proto-btn.hover-scale:hover {
  transform: scale(1.05);
}
.proto-btn.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}
.proto-btn.hover-ring:hover {
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.5);
}
.proto-btn.hover-bright:hover {
  filter: brightness(1.15);
}

@keyframes grad-anim {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}
@keyframes btn-bounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  40% {
    transform: translateY(-8px) scale(1.05);
  }
  70% {
    transform: translateY(3px) scale(0.98);
  }
}

/* play controls */
.play-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.play-btn {
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--black);
  color: white;
  border: none;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}
.play-btn:hover {
  opacity: 0.8;
}
.state-label {
  font-family: "DM Mono", monospace;
  font-size: 10px;
  color: var(--muted);
}

/* state flow */
.state-flow {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  flex-shrink: 0;
}
.state-node {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}
.state-pill {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  font-family: inherit;
}
.state-pill.active {
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}
.state-pill .pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.state-arrow {
  font-family: "DM Mono", monospace;
  font-size: 9px;
  color: var(--muted);
  padding: 0 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.state-arrow span:first-child {
  color: var(--black);
  font-size: 12px;
}
.add-state-btn {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  border: 2px dashed var(--border);
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.2s;
  white-space: nowrap;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 3px;
}
.add-state-btn:hover {
  border-color: var(--black);
  color: var(--black);
}
.delete-state-btn {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.15);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  color: white;
  line-height: 1;
  padding: 0;
  transition: background 0.2s;
}
.delete-state-btn:hover {
  background: rgba(200, 0, 0, 0.6);
}
.state-pill-label {
  outline: none;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  color: inherit;
  cursor: text;
  min-width: 36px;
  max-width: 70px;
  text-align: left;
}
.state-pill:not(.active) .state-pill-label {
  pointer-events: none;
}

/* editor scrollable body */
.editor-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* form elements */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-title {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
}
.swatch-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  align-items: center;
}
.swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s var(--spring), border-color 0.15s;
  flex-shrink: 0;
}
.swatch.active {
  border-color: var(--black);
  transform: scale(1.18);
}
.select-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.select-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
}
.sel-btn {
  padding: 6px 8px;
  border-radius: 7px;
  border: 2px solid var(--border);
  background: transparent;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  color: var(--black);
}
.sel-btn.active {
  border-color: var(--black);
  background: var(--black);
  color: white;
}
.sel-btn:hover:not(.active) {
  border-color: #aaa;
}
.icon-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}
.icon-pick {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 7px;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
}
.icon-pick svg {
  width: 14px;
  height: 14px;
  fill: var(--black);
  transition: fill 0.15s;
}
.icon-pick.active {
  border-color: var(--black);
  background: var(--black);
}
.icon-pick.active svg {
  fill: white;
}
.icon-pick:hover:not(.active) {
  border-color: #aaa;
}
.slider-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.slider-row input[type="range"] {
  flex: 1;
}
.slider-field input[type="range"],
.slider-row input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: #e0e0e0;
  outline: none;
  cursor: pointer;
}
.slider-field input[type="range"]::-webkit-slider-thumb,
.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--black);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.slider-val {
  font-family: "DM Mono", monospace;
  font-size: 10px;
  color: var(--muted);
  min-width: 28px;
  text-align: right;
}
.text-input {
  width: 100%;
  padding: 7px 9px;
  border-radius: 7px;
  border: 2px solid var(--border);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  background: transparent;
  color: var(--black);
  transition: border-color 0.15s;
}
.text-input:focus {
  border-color: var(--black);
}
.color-hex-input {
  flex: 1;
  padding: 5px 8px;
  border-radius: 6px;
  border: 2px solid var(--border);
  font-family: "DM Mono", monospace;
  font-size: 11px;
  outline: none;
  background: transparent;
  transition: border-color 0.15s;
}
.color-hex-input:focus {
  border-color: var(--black);
}
.subsection {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 9px;
  background: #f8f8f8;
  border-radius: 9px;
  border: 1px solid var(--border);
}
.subsection-title {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.speed-chips {
  display: flex;
  gap: 3px;
}
.speed-chip {
  padding: 4px 8px;
  border-radius: 5px;
  border: 2px solid var(--border);
  font-family: inherit;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  transition: all 0.15s;
}
.speed-chip.active {
  border-color: var(--black);
  background: var(--black);
  color: white;
}
.speed-chip:hover:not(.active) {
  border-color: #aaa;
}
.weight-chips {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}
.weight-chip {
  padding: 4px 7px;
  border-radius: 5px;
  border: 2px solid var(--border);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  background: transparent;
  transition: all 0.15s;
}
.weight-chip.active {
  border-color: var(--black);
  background: var(--black);
  color: white;
}
.weight-chip:hover:not(.active) {
  border-color: #aaa;
}
.radius-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.radius-btn {
  height: 32px;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.radius-btn.active {
  border-color: var(--black);
  background: var(--black);
}
.radius-btn .rp {
  width: 20px;
  height: 12px;
  background: #bbb;
}
.radius-btn.active .rp {
  background: rgba(255, 255, 255, 0.7);
}
.shadow-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.shadow-swatch {
  height: 28px;
  border-radius: 5px;
  border: 2px solid var(--border);
  background: #ddd;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #888;
}
.shadow-swatch.active {
  border-color: var(--black);
  background: var(--black);
  color: white;
}
.shadow-swatch:hover:not(.active) {
  border-color: #aaa;
}
.gradient-builder {
  background: #f8f8f8;
  border-radius: 9px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  border: 1px solid var(--border);
}
.grad-preview {
  height: 32px;
  border-radius: 7px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  transition: background 0.3s;
}
.grad-stops {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.grad-stop-row {
  display: flex;
  align-items: center;
  gap: 5px;
}
.grad-stop-row input[type="color"] {
  width: 26px;
  height: 26px;
  border: 2px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  padding: 1px;
  background: none;
  flex-shrink: 0;
}
.grad-stop-row input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: #e0e0e0;
  outline: none;
  cursor: pointer;
}
.grad-stop-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--black);
  cursor: pointer;
}
.grad-stop-pos {
  font-family: "DM Mono", monospace;
  font-size: 9px;
  color: var(--muted);
  min-width: 26px;
  text-align: right;
}
.grad-stop-del {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.1);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #666;
  transition: background 0.15s;
  padding: 0;
}
.grad-stop-del:hover {
  background: rgba(200, 0, 0, 0.5);
  color: white;
}
.grad-add-stop {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1.5px dashed var(--border);
  background: transparent;
  font-family: inherit;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.grad-add-stop:hover {
  border-color: var(--black);
  color: var(--black);
}
.grad-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.grad-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.grad-meta-item label {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.grad-type-row {
  display: flex;
  gap: 3px;
}
.grad-type-btn {
  padding: 4px 8px;
  border-radius: 5px;
  border: 2px solid var(--border);
  background: transparent;
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.grad-type-btn.active {
  border-color: var(--black);
  background: var(--black);
  color: white;
}
.grad-anim-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.toggle-switch {
  width: 30px;
  height: 16px;
  border-radius: 999px;
  background: #ddd;
  border: none;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s;
}
.toggle-switch.on {
  background: var(--black);
}
.toggle-switch.on::after {
  transform: translateX(14px);
}
.toggle-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
}
.curve-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.curve-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 3px 5px;
  border-radius: 7px;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.curve-btn.active {
  border-color: var(--black);
  background: var(--black);
}
.curve-btn.active svg path {
  stroke: white;
}
.curve-btn.active span {
  color: rgba(255, 255, 255, 0.8);
}
.curve-btn:hover:not(.active) {
  border-color: #aaa;
}
.curve-btn span {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.curve-btn svg {
  width: 32px;
  height: 20px;
  overflow: visible;
}
.curve-btn svg path {
  fill: none;
  stroke: var(--black);
  stroke-width: 2;
  stroke-linecap: round;
}

/* code output */
.code-block {
  background: #0d1117;
  border-radius: 9px;
  padding: 12px;
  font-family: "DM Mono", monospace;
  font-size: 10px;
  line-height: 1.7;
  color: #c9d1d9;
  overflow-x: auto;
  max-height: 180px;
  overflow-y: auto;
  white-space: pre;
}
.code-block .cm {
  color: #8b949e;
}
.code-block .kw {
  color: #ff7b72;
}
.code-block .prop {
  color: #79c0ff;
}
.code-block .str {
  color: #a5d6ff;
}
.code-block .val {
  color: #f2cc60;
}
.copy-btn {
  padding: 5px 10px;
  border-radius: 6px;
  background: transparent;
  border: 2px solid var(--border);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
}
.copy-btn:hover {
  border-color: var(--black);
  color: var(--black);
}
.copy-btn.copied {
  border-color: var(--green);
  color: var(--green);
}

/* presets section */
.preset-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.preset-group-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.preset-group-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 6px;
}
.preset-card {
  --pc: #111111;
  text-align: left;
  padding: 10px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: white;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.preset-card:hover {
  border-color: var(--pc);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -4px color-mix(in srgb, var(--pc) 45%, transparent);
}
.preset-swatch {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.preset-card-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.preset-card-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--black);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preset-card-states {
  font-size: 8px;
  font-weight: 600;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  letter-spacing: 0.02em;
}

/* editing label in header */
#editing-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── KEYBOARD NAV HINT ── */
.gallery-nav-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "DM Mono", monospace;
  font-size: 9px;
  color: var(--muted);
}
.gallery-nav-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: inherit;
  font-size: 9px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  color: var(--black);
}
/* ── STATE INFO PANEL ── */
.state-info-panel {
  width: 0;
  flex-shrink: 0;
  background: #fff;
  border-left: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: width 0.22s ease, opacity 0.2s ease;
  opacity: 0;
  pointer-events: none;
}
.state-info-panel.open {
  width: 320px;
  opacity: 1;
  pointer-events: auto;
  overflow-y: auto;
}
.state-info-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.state-info-panel-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
/* keep old header style alias for panel */
.state-info-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.state-info-modal-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.state-info-modal-badge {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #f4f1ff;
  color: #7c3aed;
  border-radius: 5px;
  padding: 2px 7px;
}
.state-info-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: #f5f5f5;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  transition: background 0.12s;
}
.state-info-close:hover {
  background: #ececec;
  color: #111;
}
.state-info-modal-body {
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.state-info-section-title {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #aaa;
  margin-bottom: 8px;
}
.state-info-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.state-info-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #f8f8f8;
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 11px;
  color: #444;
}
.state-info-chip-key {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #aaa;
}
.state-info-chip-val {
  font-weight: 600;
  color: #222;
}
.state-info-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}
.state-info-code-block {
  background: #1a1a2e;
  border-radius: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: "DM Mono", monospace;
  font-size: 11px;
  line-height: 1.7;
  color: #c9d1d9;
  position: relative;
}
.state-info-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.state-info-code-lang {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #888;
  font-family: "DM Mono", monospace;
}
.state-info-copy-btn {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 5px;
  border: 1px solid #444;
  background: #2a2a3e;
  color: #ccc;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  font-family: inherit;
}
.state-info-copy-btn:hover {
  background: #3a3a5e;
  color: #fff;
}
.state-info-copy-btn.copied {
  background: #1a6b1a;
  color: #aeffae;
  border-color: #2a8b2a;
}
.si-cm {
  color: #6a9955;
}
.si-kw {
  color: #c792ea;
}
.si-prop {
  color: #82aaff;
}
.si-val {
  color: #f78c6c;
}
.si-str {
  color: #c3e88d;
}
/* Info button in gallery cell */
.gallery-info-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: none;
  background: rgba(120, 100, 200, 0.1);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  color: #9b8aee;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
  opacity: 0;
}
.gallery-cell:hover .gallery-info-btn {
  opacity: 1;
}
.gallery-info-btn:hover {
  background: rgba(120, 100, 200, 0.22);
  color: #7c3aed;
}
