:root {
  --bg: #06080d;
  --surface: #121826;
  --border: rgba(148, 163, 184, 0.16);
  --text: #e8ecf4;
  --muted: #94a3b8;
  --teal: #14b8a6;
  --teal-2: #2dd4bf;
  --teal-glow: rgba(20, 184, 166, 0.45);
  --radius: 12px;
  --aspect: 56.25%;
  --chrome-h: 44px;
  --topnav-h: 42px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.embed-mode .page-header,
body.embed-mode .embed-note { display: none; }
body.embed-mode .page { padding-top: 8px; max-width: none; }

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  text-decoration: none;
}
.brand img { width: 28px; height: 28px; }
.cta-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--teal), var(--teal-2));
  color: #041018;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.cta-link:hover { filter: brightness(1.06); }

.demo-wrap {
  position: relative;
  width: 100%;
  padding-bottom: calc(var(--aspect) + var(--chrome-h) + var(--topnav-h));
  height: 0;
  border-radius: calc(var(--radius) + 4px);
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--border), 0 24px 80px rgba(0, 0, 0, 0.55);
  background: var(--surface);
  container-type: inline-size;
  container-name: demo;
}

.demo-topnav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topnav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  background: rgba(10, 14, 23, 0.98);
  border-bottom: 1px solid var(--border);
  z-index: 6;
}
.topnav-btns { display: flex; gap: 6px; align-items: center; }
.topnav-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.topnav-btn:hover:not(:disabled) {
  border-color: var(--teal);
  color: var(--teal-2);
  background: rgba(20, 184, 166, 0.08);
}
.topnav-btn:disabled { opacity: 0.32; cursor: default; }
.topnav-btn .arrow { font-size: 14px; line-height: 1; }
.topnav-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.demo-stage {
  position: absolute;
  top: var(--topnav-h);
  left: 0;
  right: 0;
  bottom: var(--chrome-h);
  background: #0a0e17;
  container-type: inline-size;
  container-name: stage;
}
.demo-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.demo-slide.is-active {
  opacity: 1;
  pointer-events: auto;
}
.slide-fit {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slide-fit img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}
.slide-overlays {
  position: absolute;
  pointer-events: none;
}
.slide-overlays > * { pointer-events: auto; }

.hotspot {
  position: absolute;
  border: 2px solid var(--teal-2);
  background: rgba(20, 184, 166, 0.12);
  box-shadow: 0 0 0 0 var(--teal-glow);
  cursor: pointer;
  animation: pulse 2.2s ease-in-out infinite;
  z-index: 3;
  padding: 0;
}
.hotspot--pill { border-radius: 999px; }
.hotspot--rect { border-radius: var(--hs-radius, 10px); }
.hotspot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 1px solid rgba(45, 212, 191, 0.35);
  pointer-events: none;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--teal-glow); }
  50% { box-shadow: 0 0 0 8px rgba(20, 184, 166, 0); }
}

.tooltip {
  --tip-title: clamp(12px, 3.6cqw, 17px);
  --tip-body: clamp(11px, 2.9cqw, 13.5px);
  position: absolute;
  z-index: 4;
  display: flex;
  flex-direction: column;
  max-height: min(46cqh, 50%);
  width: min(34cqw, 320px);
  min-width: 180px;
  padding: 11px 13px 9px;
  border-radius: var(--radius);
  background: linear-gradient(155deg, rgba(20, 184, 166, 0.97), rgba(13, 148, 136, 0.94));
  color: #041018;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
}
.tooltip--compact { width: min(31cqw, 290px); }
.tooltip--wide { width: min(36cqw, 360px); }

.tooltip-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 3px;
  scrollbar-width: thin;
  scrollbar-color: rgba(4, 16, 24, 0.35) transparent;
}
.tooltip-scroll::-webkit-scrollbar { width: 4px; }
.tooltip-scroll::-webkit-scrollbar-thumb {
  background: rgba(4, 16, 24, 0.3);
  border-radius: 4px;
}
.tooltip h2 {
  font-size: var(--tip-title);
  line-height: 1.28;
  font-weight: 700;
  margin-bottom: 5px;
  letter-spacing: -0.01em;
}
.tooltip p {
  font-size: var(--tip-body);
  line-height: 1.45;
  opacity: 0.94;
}
.tooltip-foot {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  padding-top: 7px;
}
.tooltip-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: #fff;
  color: var(--teal);
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease;
}
.tooltip-cta:hover { transform: translateX(2px); }
.tooltip--body-only h2 { display: none; }
.tooltip.is-tight { --tip-body: clamp(10px, 2.6cqw, 12px); }
.tooltip.is-tighter { --tip-body: clamp(9.5px, 2.4cqw, 11px); }

.demo-chrome {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--chrome-h);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 14px;
  background: rgba(10, 14, 23, 0.97);
  border-top: 1px solid var(--border);
  z-index: 5;
}
.dots { display: flex; gap: 5px; align-items: center; }
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.35);
  border: none;
  padding: 0;
  cursor: pointer;
}
.dot.is-active { background: var(--teal); }
.dot:hover { background: var(--teal-2); }

.embed-note {
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.embed-note code {
  font-size: 12px;
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

@container stage (max-width: 640px) {
  .tooltip {
    max-height: 42%;
    width: auto !important;
    left: 6px !important;
    right: 6px !important;
  }
  .topnav-btn span.lbl { display: none; }
}

body.calibrate-mode .hotspot {
  animation: none;
  cursor: move;
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
}
body.calibrate-mode .hotspot::after { border-color: rgba(251, 191, 36, 0.5); }
.calibrate-bar {
  display: none;
  position: absolute;
  top: var(--topnav-h);
  left: 0;
  right: 0;
  z-index: 7;
  padding: 6px 10px;
  background: rgba(251, 191, 36, 0.12);
  border-bottom: 1px solid rgba(251, 191, 36, 0.35);
  font-size: 11px;
  color: #fde68a;
  line-height: 1.4;
}
body.calibrate-mode .calibrate-bar { display: block; }
body.calibrate-mode .demo-stage { top: calc(var(--topnav-h) + 72px); }
body.calibrate-mode .demo-wrap {
  padding-bottom: calc(var(--aspect) + var(--chrome-h) + var(--topnav-h) + 72px);
}
.calibrate-bar code {
  font-size: 10px;
  color: #fef3c7;
  word-break: break-all;
}
.calibrate-bar button {
  margin-top: 4px;
  margin-right: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(251, 191, 36, 0.5);
  background: rgba(0, 0, 0, 0.3);
  color: #fde68a;
  font-size: 11px;
  cursor: pointer;
}
.calibrate-bar .cal-btn-save {
  border-color: rgba(45, 212, 191, 0.7);
  background: rgba(45, 212, 191, 0.2);
  color: #ccfbf1;
  font-weight: 600;
}
.calibrate-bar .cal-save-hint {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: rgba(253, 230, 138, 0.85);
}
.hs-handle {
  display: none;
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fbbf24;
  border: 1px solid #000;
  border-radius: 2px;
  z-index: 5;
  cursor: nwse-resize;
}
body.calibrate-mode .hs-handle { display: block; }
.hs-handle.se { right: -5px; bottom: -5px; cursor: se-resize; }
body.calibrate-mode .tooltip { opacity: 0.35; pointer-events: none; }
body.calibrate-mode.calibrate-tooltips .tooltip {
  opacity: 1;
  pointer-events: auto;
  cursor: move;
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.35);
}
body.calibrate-mode.calibrate-tooltips .hotspot {
  animation: none;
  opacity: 0.35;
  pointer-events: none;
}
body.calibrate-mode .slide-overlays { cursor: crosshair; }
body.calibrate-mode.calibrate-tooltips .slide-overlays { cursor: default; }
.cal-target-btn {
  margin-right: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(251, 191, 36, 0.5);
  background: rgba(0, 0, 0, 0.3);
  color: #fde68a;
  font-size: 11px;
  cursor: pointer;
}
.cal-target-btn.is-active {
  background: rgba(251, 191, 36, 0.35);
  color: #fffbeb;
}
.cal-draw-preview {
  display: none;
  position: absolute;
  border: 2px dashed #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  pointer-events: none;
  z-index: 4;
}
body.calibrate-mode .cal-draw-preview.is-active { display: block; }
