:root {
  --tour-edge: max(1rem, env(safe-area-inset-right));
  --tour-floor: calc(1rem + env(safe-area-inset-bottom));
  --tour-launch-height: 44px;
  --tour-panel-floor: calc(var(--tour-floor) + var(--tour-launch-height) + .65rem);
}

.tour-launch, .tour-panel {
  position: fixed;
  right: var(--tour-edge);
  background: var(--panel);
  border: 1px solid var(--line);
}

.tour-launch {
  z-index: 38;
  bottom: var(--tour-floor);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: var(--tour-launch-height);
  padding: .5rem .85rem;
  border-radius: 8px;
  box-shadow: 0 3px 14px #0002;
  font-size: .88rem;
  font-weight: 650;
}

.tour-launch svg, .tour-name svg {
  flex: none;
  width: 1.2rem;
  height: 1.2rem;
  color: var(--good);
}

.tour-launch[aria-expanded="true"] {
  background: var(--panel2);
  border-color: color-mix(in srgb, var(--good) 55%, var(--line));
}

.tour-panel {
  z-index: 39;
  bottom: var(--tour-panel-floor);
  width: min(22rem, calc(100vw - var(--tour-edge) - max(1rem, env(safe-area-inset-left))));
  max-height: calc(100dvh - var(--tour-panel-floor) - max(.75rem, env(safe-area-inset-top)));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 10px;
  border-top: 2px solid var(--good);
  box-shadow: 0 8px 24px #0003, var(--shadow);
}

.tour-panel[hidden], .tour-actions button[hidden] { display: none; }

.tour-head {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  min-height: 3.25rem;
  padding: .2rem .55rem .2rem 1rem;
  border-bottom: 1px solid var(--line);
}

.tour-name {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: .87rem;
  font-weight: 650;
}

.tour-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  line-height: 1;
  font-size: 1.3rem;
}

.tour-close svg {
  width: 1rem;
  height: 1rem;
}

.tour-close:focus-visible { outline-offset: -3px; }

.tour-body {
  padding: .95rem 1rem 1rem;
  overflow: auto;
  overscroll-behavior: contain;
}

.tour-progress {
  display: flex;
  align-items: center;
  gap: .85rem;
  margin-bottom: .75rem;
  color: var(--muted);
  font-size: .76rem;
  font-variant-numeric: tabular-nums;
}

.tour-progress progress {
  flex: 1;
  height: 3px;
  min-width: 2rem;
}

#tour-title {
  margin: 0 0 .4rem;
  font-size: 1.24rem;
  line-height: 1.2;
}

#tour-description {
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.5;
}

.tour-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .5rem;
}

.tour-actions button {
  padding-inline: .85rem;
  font-size: .85rem;
}

#tour-next {
  color: var(--ink);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 650;
}

#tour-next:hover:not(:disabled) { filter: brightness(1.08); }

#tour-later {
  margin-right: auto;
  padding: .4rem .25rem;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: .8rem;
  text-decoration: underline;
  text-underline-offset: .2em;
}

#tour-later:hover { color: var(--text); }

.tour-target {
  outline: 2px solid var(--good);
  outline-offset: 3px;
  scroll-margin-block: 5rem;
}

.tour-target:focus-visible { outline-style: dashed; }

/* Deixe a escolha de cookies no fluxo da página quando o tour está disponível. */
body:has(.tour-launch) #cookie-banner.consent-banner {
  position: static;
  z-index: auto;
  width: min(1040px, calc(100% - 2rem));
  margin: 1rem auto 0;
  box-shadow: none;
}

@media (max-width: 899px) {
  :root { --tour-floor: calc(5rem + env(safe-area-inset-bottom)); }
}

@media print {
  .tour-launch, .tour-panel { display: none !important; }
  .tour-target { outline: none; }
}
