.tfm-guide-layer {
  --tfm-guide-accent: #e8508f;
  --tfm-guide-glow: #e8508fcc;
  --tfm-guide-surface: #161428;
  --tfm-guide-text: #ffffff;
  --tfm-guide-x: 10px;
  --tfm-guide-y: 10px;
  --tfm-guide-avatar-x: 10px;
  --tfm-guide-avatar-y: 120px;
  --tfm-guide-safe-top: env(safe-area-inset-top, 0px);
  --tfm-guide-safe-right: env(safe-area-inset-right, 0px);
  --tfm-guide-safe-bottom: env(safe-area-inset-bottom, 0px);
  --tfm-guide-safe-left: env(safe-area-inset-left, 0px);
  position: fixed;
  inset: 0;
  z-index: 140;
  pointer-events: none;
  color: var(--tfm-guide-text);
  font: 600 14px/1.4 system-ui, sans-serif;
}

.tfm-guide-bubble {
  position: fixed;
  left: var(--tfm-guide-x);
  top: var(--tfm-guide-y);
  width: min(290px, calc(100vw - 20px));
  max-height: min(44vh, 260px);
  overflow: auto;
  box-sizing: border-box;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--tfm-guide-accent) 70%, white);
  border-radius: 18px;
  background: color-mix(in srgb, var(--tfm-guide-surface) 94%, transparent);
  box-shadow: 0 10px 34px #0008, 0 0 24px var(--tfm-guide-glow);
  pointer-events: auto;
  transition: left 260ms ease, top 260ms ease, opacity 160ms ease;
}

.tfm-guide-avatar {
  position: fixed;
  left: var(--tfm-guide-avatar-x);
  top: var(--tfm-guide-avatar-y);
  width: 72px;
  height: 72px;
  min-width: 44px;
  min-height: 44px;
  box-sizing: border-box;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--tfm-guide-accent) 70%, white);
  border-radius: 22px;
  background: var(--tfm-guide-surface);
  box-shadow: 0 0 28px var(--tfm-guide-glow);
  cursor: grab;
  touch-action: none;
  user-select: none;
  pointer-events: auto;
  transition: left 260ms ease, top 260ms ease, box-shadow 180ms ease;
}

.tfm-guide-avatar:active {
  cursor: grabbing;
}

.tfm-guide-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tfm-guide-instant-placement .tfm-guide-bubble,
.tfm-guide-instant-placement .tfm-guide-avatar {
  transition: none;
}

.tfm-guide-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.tfm-guide-message,
.tfm-guide-recovery {
  margin: 0;
}

.tfm-guide-recovery {
  margin-top: 7px;
  color: color-mix(in srgb, var(--tfm-guide-text) 74%, transparent);
  font-size: 12px;
}

.tfm-guide-controls {
  display: flex;
  gap: 8px;
  margin-top: 11px;
}

.tfm-guide-layer[data-mode="follow"] .tfm-guide-resume,
.tfm-guide-layer[data-mode="pinned"] .tfm-guide-pin {
  display: none;
}

.tfm-guide-control {
  min-width: 44px;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--tfm-guide-accent) 65%, white);
  border-radius: 12px;
  color: var(--tfm-guide-text);
  background: color-mix(in srgb, var(--tfm-guide-accent) 22%, var(--tfm-guide-surface));
  font: inherit;
  cursor: pointer;
}

.tfm-guide-target {
  position: relative;
  z-index: 1;
  outline: 3px solid var(--tfm-guide-accent, #e8508f) !important;
  outline-offset: 4px;
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--tfm-guide-glow, #e8508fcc) 32%, transparent);
  animation: tfm-guide-target-pulse 1.5s ease-in-out infinite;
}

.tfm-guide-layer[data-mode="quiet"] .tfm-guide-bubble,
.tfm-guide-layer[data-fault="inert"] .tfm-guide-bubble {
  display: none;
}

.tfm-guide-layer[data-attention="warning"] .tfm-guide-bubble {
  border-color: #ffc857;
}

@keyframes tfm-guide-target-pulse {
  50% {
    outline-offset: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tfm-guide-bubble,
  .tfm-guide-avatar {
    transition: none;
  }

  .tfm-guide-target {
    animation: none;
  }
}

@media (forced-colors: active) {
  .tfm-guide-bubble,
  .tfm-guide-avatar,
  .tfm-guide-control,
  .tfm-guide-target {
    border: 2px solid CanvasText;
    outline: 2px solid Highlight !important;
    box-shadow: none;
  }
}
