body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.demo-shell {
  min-height: 100vh;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

.demo-header {
  align-items: center;
  border-bottom: 1px solid hsl(var(--border));
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 1rem clamp(1rem, 4vw, 3rem);
}

.demo-brand {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.demo-layout {
  display: grid;
  gap: 2rem;
  grid-template-columns: 16rem minmax(0, 1fr);
  padding: 2rem clamp(1rem, 4vw, 3rem);
}

.demo-nav {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.demo-content {
  display: grid;
  gap: 1.5rem;
  max-width: 78rem;
}

.demo-hero {
  display: grid;
  gap: .75rem;
}

.demo-hero h1 {
  font-size: clamp(2rem, 5vw, 4rem);
  letter-spacing: -0.06em;
  line-height: .95;
  margin: 0;
}

.demo-muted {
  color: hsl(var(--muted-foreground));
  line-height: 1.7;
  margin: 0;
}

.demo-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.demo-category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.demo-category-link {
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  color: hsl(var(--foreground));
  font-size: .875rem;
  font-weight: 500;
  padding: .4rem .8rem;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}

.demo-category-link:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.demo-component-browser {
  align-items: start;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(12rem, 15rem) minmax(0, 1fr);
}

.demo-component-tabs {
  align-self: start;
  border: 1px solid hsl(var(--border));
  border-radius: .875rem;
  display: grid;
  gap: .25rem;
  max-height: calc(100vh - 8rem);
  overflow: auto;
  padding: .5rem;
  position: sticky;
  top: 1rem;
}

.demo-component-tab-group {
  color: hsl(var(--muted-foreground));
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  padding: .75rem .65rem .25rem;
  text-transform: uppercase;
}

.demo-component-tab {
  background: transparent;
  border: 0;
  border-radius: .55rem;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  font: inherit;
  font-size: .875rem;
  font-weight: 500;
  padding: .55rem .65rem;
  text-align: left;
  transition: background-color .15s ease, color .15s ease;
}

.demo-component-tab:hover,
.demo-component-tab.is-active {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.demo-component-panel {
  min-width: 0;
}

.demo-section {
  display: grid;
  gap: 1rem;
  scroll-margin-top: 1rem;
}

.demo-section-header {
  border-bottom: 1px solid hsl(var(--border));
  display: grid;
  gap: .35rem;
  padding-bottom: .75rem;
}

.demo-section-title {
  font-size: clamp(1.35rem, 3vw, 2rem);
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin: 0;
}

.demo-example {
  border: 1px solid hsl(var(--border));
  border-radius: .75rem;
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.demo-example h2 {
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  margin: 0;
}

.demo-example-body {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) minmax(22rem, .95fr);
}

.demo-preview {
  align-items: center;
  border: 1px dashed hsl(var(--border));
  border-radius: .5rem;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  min-height: 5rem;
  padding: 1rem;
}

.demo-preview input {
  max-width: 22rem;
}

.demo-preview textarea {
  max-width: 26rem;
}

.demo-preview select {
  max-width: 22rem;
}

.demo-preview input[type="range"] {
  max-width: 22rem;
}

.demo-preview [role="radiogroup"] {
  min-width: 14rem;
}

.demo-form-preview {
  align-items: stretch;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.demo-tabs-preview > div {
  width: min(100%, 32rem);
}

.demo-aspect-preview > div {
  width: min(100%, 24rem);
}

.demo-aspect-box {
  align-items: center;
  background: linear-gradient(135deg, hsl(var(--muted)), hsl(var(--accent)));
  color: hsl(var(--foreground));
  display: flex;
  font-weight: 700;
  height: 100%;
  justify-content: center;
  width: 100%;
}

.demo-stack-preview {
  align-items: stretch;
  display: grid;
  grid-template-columns: 1fr;
}

.demo-resizable-preview {
  align-items: stretch;
  display: grid;
  grid-template-columns: 1fr;
}

.demo-resizable-preview > div {
  min-height: 10rem;
}

.demo-icon-gallery-controls {
  display: grid;
  gap: .75rem;
}

.demo-icon-gallery-controls input {
  max-width: 32rem;
}

.demo-icon-gallery {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
}

.demo-icon-card {
  align-items: center;
  border: 1px solid hsl(var(--border));
  border-radius: .75rem;
  display: grid;
  gap: .45rem;
  justify-items: center;
  min-height: 7rem;
  padding: .75rem;
  text-align: center;
}

.demo-icon-name {
  color: hsl(var(--foreground));
  font-size: .8rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.demo-icon-code {
  color: hsl(var(--muted-foreground));
  font-size: .68rem;
  overflow-wrap: anywhere;
}

.demo-preview [role="alert"] {
  width: 100%;
}

.demo-control-label {
  align-items: center;
  display: inline-flex;
  gap: .5rem;
}

.demo-overlay-panel {
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: .75rem;
  box-shadow: 0 24px 64px hsl(var(--foreground) / .18);
  color: hsl(var(--foreground));
  display: grid;
  gap: .75rem;
  max-width: min(28rem, calc(100vw - 2rem));
  padding: 1.25rem;
}

.demo-overlay-panel h3 {
  font-size: 1.125rem;
  letter-spacing: -.03em;
  margin: 0;
}

.demo-code {
  background: hsl(var(--muted));
  border-radius: .5rem;
  color: hsl(var(--foreground));
  overflow: auto;
  padding: 1rem;
  tab-size: 2;
  white-space: pre-wrap;
}

@media (max-width: 760px) {
  .demo-layout {
    grid-template-columns: 1fr;
  }

  .demo-component-browser {
    grid-template-columns: 1fr;
  }

  .demo-component-tabs {
    display: flex;
    max-height: none;
    overflow-x: auto;
    position: static;
  }

  .demo-component-tab-group {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    padding: .55rem .35rem;
  }

  .demo-component-tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .demo-example-body {
    grid-template-columns: 1fr;
  }
}
