:root {
  --demo-guide-accent: #1f5eff;
  --demo-guide-accent-dark: #143d91;
  --demo-guide-accent-soft: #edf4ff;
}

.demo-guide-tip {
  position: absolute;
  z-index: 1000;
  width: min(310px, calc(100vw - 24px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 13px 12px 13px 14px;
  border: 1px solid color-mix(in srgb, var(--demo-guide-accent) 38%, white);
  border-radius: 10px;
  background: #fff;
  color: #17202a;
  box-shadow: 0 16px 38px rgba(16, 32, 51, .18);
  font: 14px/1.42 Inter, "Segoe UI", Arial, sans-serif;
  animation: demo-guide-arrive 180ms ease-out;
}

.demo-guide-tip[hidden] { display: none; }

.demo-guide-live {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.demo-guide-slot:empty { display: none; }

.demo-guide-slot:not(:empty) {
  display: inline-flex;
  align-items: center;
  width: min(310px, 100%);
  max-width: 100%;
}

.demo-guide-tip[data-mode="inline"] {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
}

.demo-guide-tip::after {
  content: "";
  position: absolute;
  left: var(--demo-guide-arrow-left, 50%);
  width: 12px;
  height: 12px;
  border-right: 2px solid var(--demo-guide-accent);
  border-bottom: 2px solid var(--demo-guide-accent);
  background: #fff;
  transform-origin: center;
  animation: demo-guide-arrow 1.25s ease-in-out infinite;
}

.demo-guide-tip[data-placement="above"]::after {
  bottom: -8px;
  transform: translateX(-50%) rotate(45deg);
}

.demo-guide-tip[data-placement="below"]::after {
  top: -8px;
  transform: translateX(-50%) rotate(225deg);
}

.demo-guide-tip[data-mode="inline"]::after {
  top: 50%;
  left: -8px;
  transform: translateY(-50%) rotate(135deg);
}

.demo-guide-content { min-width: 0; display: grid; gap: 5px; }

.demo-guide-label {
  width: max-content;
  max-width: 100%;
  padding: 3px 7px;
  border: 1px solid color-mix(in srgb, var(--demo-guide-accent) 32%, white);
  border-radius: 999px;
  background: var(--demo-guide-accent-soft);
  color: var(--demo-guide-accent-dark);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.demo-guide-tip[data-kind="fact"] .demo-guide-label {
  background: #f7fbff;
}

.demo-guide-message { color: #344255; font-weight: 720; }

.demo-guide-close {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #65738b;
  cursor: pointer;
  font: 700 20px/1 Arial, sans-serif;
}

.demo-guide-close:hover { background: #f0f4f8; color: #17202a; }
.demo-guide-close:focus-visible { outline: 3px solid #ffbf47; outline-offset: 2px; }

.demo-guide-target {
  outline: 3px solid color-mix(in srgb, var(--demo-guide-accent) 34%, transparent) !important;
  outline-offset: 4px !important;
  animation: demo-guide-target 1.25s ease-in-out infinite;
}

@keyframes demo-guide-arrive {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes demo-guide-arrow {
  0%, 100% { margin-top: 0; }
  50% { margin-top: 4px; }
}

@keyframes demo-guide-target {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--demo-guide-accent) 25%, transparent); }
  50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--demo-guide-accent) 0%, transparent); }
}

@media (max-width: 560px) {
  .demo-guide-tip { width: min(288px, calc(100vw - 20px)); padding: 12px; }
  .demo-guide-slot:not(:empty) { width: min(288px, 100%); }
  .demo-guide-tip[data-mode="inline"] { width: 100%; }
  .demo-guide-tip[data-mode="inline"]::after {
    top: -8px;
    left: 28px;
    transform: translateX(-50%) rotate(225deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .demo-guide-tip,
  .demo-guide-tip::after,
  .demo-guide-target {
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
