.demo-section {
  padding-top: 8px;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.demo-grid-wide {
  grid-template-columns: 1fr;
  margin-top: 20px;
}

.demo-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.demo-card h3 {
  margin: 0;
  font-size: 17px;
}

.demo-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
}

.demo-stage {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #eef2f8 0%, #e2e8f0 100%);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.demo-chrome {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  background: #dfe6f0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.demo-chrome span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
}

.demo-chrome span:first-child { background: #f87171; }
.demo-chrome span:nth-child(2) { background: #fbbf24; }
.demo-chrome span:nth-child(3) { background: #4ade80; }

.demo-chrome .demo-url {
  flex: 1;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.75);
  color: #64748b;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-page {
  position: absolute;
  inset: 28px 0 0;
  padding: 14px 16px;
  background: #fff;
}

.demo-line {
  height: 8px;
  border-radius: 4px;
  background: #e2e8f0;
  margin-bottom: 8px;
}

.demo-line.title {
  width: 58%;
  height: 11px;
  background: #cbd5e1;
}

.demo-line.short { width: 42%; }
.demo-line.medium { width: 72%; }
.demo-line.long { width: 88%; }

.demo-image-block {
  margin: 10px 0;
  height: 46px;
  border-radius: 8px;
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

.demo-popup {
  position: absolute;
  top: 42px;
  right: 12px;
  width: 118px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid #c9d6e8;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
}

.demo-popup button {
  display: block;
  width: 100%;
  margin: 0 0 5px;
  padding: 5px 6px;
  border-radius: 7px;
  border: 1px solid #8ca3c0;
  background: #fff;
  color: #1f2937;
  font-size: 9px;
  line-height: 1.2;
  text-align: center;
}

.demo-popup button:last-child {
  margin-bottom: 0;
}

.demo-popup button.primary {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #fff;
}

.demo-dim {
  position: absolute;
  inset: 28px 0 0;
  background: rgba(0, 0, 0, 0.16);
  pointer-events: none;
}

.demo-selection {
  position: absolute;
  border: 2px solid #20a27c;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.18);
  background: transparent;
}

.demo-selection.selecting {
  top: 52px;
  left: 18px;
  width: 62%;
  height: 58%;
}

.demo-selection.editing {
  top: 48px;
  left: 14px;
  width: 68%;
  height: 62%;
  border-color: #4a78ff;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.04);
}

.demo-info {
  position: absolute;
  top: 36px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(22, 28, 36, 0.9);
  color: #fff;
  font-size: 8px;
  font-family: ui-monospace, Consolas, monospace;
  white-space: nowrap;
}

.demo-shape {
  position: absolute;
  pointer-events: none;
}

.demo-shape.rect {
  top: 18%;
  left: 10%;
  width: 38%;
  height: 28%;
  border: 2px solid #ff3b30;
  border-radius: 2px;
}

.demo-shape.arrow {
  top: 42%;
  left: 48%;
  width: 28%;
  height: 18%;
}

.demo-shape.arrow::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 78%;
  height: 2px;
  background: #ff3b30;
  transform: translateY(-50%);
}

.demo-shape.arrow::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid #ff3b30;
  transform: translateY(-50%);
}

.demo-shape.text {
  top: 14%;
  left: 52%;
  color: #ff3b30;
  font-size: 11px;
  font-weight: 700;
}

.demo-mosaic {
  position: absolute;
  top: 58%;
  left: 22%;
  width: 26%;
  height: 22%;
  border-radius: 2px;
  background:
    repeating-linear-gradient(0deg, #94a3b8 0 4px, #cbd5e1 4px 8px),
    repeating-linear-gradient(90deg, #64748b 0 4px, #94a3b8 4px 8px);
  opacity: 0.92;
}

.demo-toolbar {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid rgba(72, 89, 117, 0.35);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
}

.demo-toolbar .tool {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1px solid #c5d0e6;
  background: #fff;
  color: #22314d;
  font-size: 9px;
  line-height: 16px;
  text-align: center;
}

.demo-toolbar .tool.active {
  border-color: #1f6feb;
  background: #eff6ff;
}

.demo-toolbar .dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  border: 1px solid rgba(148, 163, 184, 0.8);
}

.demo-toolbar .dot.red { background: #ff3b30; }
.demo-toolbar .dot.blue { background: #3b82f6; }
.demo-toolbar .save {
  padding: 0 6px;
  height: 18px;
  border-radius: 5px;
  border: 1px solid #1f6feb;
  background: #1f6feb;
  color: #fff;
  font-size: 8px;
  line-height: 16px;
}

.demo-progress {
  position: absolute;
  inset: 28px auto 0 0;
  width: 34%;
  padding: 12px 10px;
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
}

.demo-progress h4 {
  margin: 0 0 8px;
  font-size: 10px;
  color: #1e293b;
}

.demo-progress .bar {
  height: 5px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin-bottom: 8px;
}

.demo-progress .bar span {
  display: block;
  width: 68%;
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
}

.demo-progress .status {
  font-size: 8px;
  color: #64748b;
  line-height: 1.4;
}

.demo-long-page {
  position: absolute;
  top: 28px;
  right: 0;
  bottom: 0;
  left: 34%;
  background: #fff;
  padding: 10px;
}

.demo-long-page .slice {
  height: 22%;
  margin-bottom: 6px;
  border-radius: 4px;
  background: linear-gradient(180deg, #f1f5f9, #e2e8f0);
  border: 1px dashed #cbd5e1;
}

@media (max-width: 960px) {
  .demo-grid {
    grid-template-columns: 1fr;
  }
}
