/* Explain mode (markers and popover), the shared "Under the hood" disclosure, live notes and simulated progress. */

.main { position: relative; }
.explain-layer { position: absolute; top: 0; left: 0; z-index: 20; width: 0; height: 0; }
.explain-marker {
  position: absolute;
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9999px;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg);
  color: var(--on-accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  animation: pop-in var(--duration-base) var(--ease-out) backwards;
}
.explain-marker:hover, .explain-marker[aria-expanded="true"] { background: var(--accent-active); }
.explain-marker:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--fg); }
.explain-pop {
  position: fixed;
  z-index: 55;
  display: flex;
  width: min(360px, calc(100vw - 16px));
  max-height: calc(100vh - 16px);
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 14px 16px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-card);
  background: var(--raised);
  box-shadow: var(--shadow-float);
  outline: none;
  animation: pop-in var(--duration-base) var(--ease-out) backwards;
}
.explain-pop-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.explain-pop-head h2 { padding-top: 4px; }
.explain-pop .hood { margin-top: 0; }

.live-note { display: flex; align-items: flex-start; gap: 8px; color: var(--muted); }
.live-note svg.icon { flex-shrink: 0; margin-top: 2px; color: var(--accent); }
.live-note strong { color: var(--fg); font-weight: 500; }

/* "Under the hood": closed by default, a native <details> so it works with the keyboard. */
.hood { margin-top: auto; border-top: 1px solid var(--line); padding-top: 8px; }
.hood-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 2px;
  border-radius: var(--radius-badge);
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}
.hood-summary::-webkit-details-marker { display: none; }
.hood-summary:hover { color: var(--fg); }
.hood-summary:focus-visible { outline: none; box-shadow: 0 0 0 1px var(--accent); }
.hood-chevron { transition: transform var(--duration-fast) var(--ease-out); }
.hood[open] .hood-chevron { transform: rotate(90deg); }
.hood-body { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; }
.code { margin: 0; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--bg); overflow: hidden; }
.code-label { display: block; padding: 6px 10px; border-bottom: 1px solid var(--line); color: var(--muted); }
.code pre { margin: 0; padding: 10px; overflow-x: auto; }
.code code { color: var(--fg); white-space: pre; }


/* Guided tour: a floating, non-modal panel above the bottom nav and below overlays (50), popovers (55) and toasts (60). */
.tour {
  position: fixed;
  right: 16px;
  bottom: calc(64px + env(safe-area-inset-bottom));
  left: 16px;
  z-index: 45;
  max-width: 480px;
  margin-inline: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-card);
  background: var(--raised);
  box-shadow: var(--shadow-float);
  animation: rise-in var(--duration-base) var(--ease-out) backwards;
}
.tour-body { display: flex; max-height: 40vh; flex-direction: column; gap: 6px; overflow-y: auto; padding: 14px 16px 10px; }
.tour-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.tour-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
  text-align: left;
  transition: color var(--duration-fast) var(--ease-out);
}
.tour-link[hidden] { display: none; }
.tour-link:hover { color: var(--fg); }
.tour-link:focus-visible { outline: none; box-shadow: 0 0 0 1px var(--accent); border-radius: var(--radius-badge); }
.tour-pill { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px 8px 16px; border-top: 1px solid var(--line); }
.tour-step { color: var(--muted); white-space: nowrap; }
.tour-actions { display: flex; gap: 4px; }
/* The highlighted anchor of the current step. */
.tour-target { outline: 2px solid var(--accent); outline-offset: 2px; scroll-margin-top: 72px; }
/* Room below the page so its last part can scroll out from under the panel. */
.has-tour .main { padding-bottom: calc(var(--tour-space, 0px) + 96px); }
@media (min-width: 768px) {
  .tour { bottom: 24px; }
  .has-tour .main { padding-bottom: calc(var(--tour-space, 0px) + 48px); }
}
