/* Learn: the guided lessons' launcher, panel, spotlight, bubble and cursor (guide.js). Uses the page's tokens. */
:root {
  --guide-accent: #d4683f;
  --guide-accent-ink: #ffffff;
  --guide-accent-soft: rgba(212, 104, 63, 0.12);
  --guide-shade: rgba(12, 12, 10, 0.42);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --guide-accent: #e0805a;
    --guide-accent-ink: #1a1a19;
    --guide-accent-soft: rgba(224, 128, 90, 0.16);
    --guide-shade: rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  --guide-accent: #e0805a;
  --guide-accent-ink: #1a1a19;
  --guide-accent-soft: rgba(224, 128, 90, 0.16);
  --guide-shade: rgba(0, 0, 0, 0.6);
}

/* the launcher in the page head */
.guide-launch { display: inline-flex; align-items: center; gap: 6px; position: relative; }
.guide-cap { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.guide-launch .guide-cap { color: var(--guide-accent); }
.guide-badge { min-width: 18px; height: 18px; border-radius: 999px; background: var(--guide-accent); color: var(--guide-accent-ink); font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.guide-badge[hidden] { display: none; }
.start-page .page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }

/* a lesson on a wide screen: the page keeps the left, the bubble gets a column of its own on the right (guide.js DOCK_MIN_VIEWPORT) */
html.guide-docked { padding-right: 432px; }
html.guide-docked .receipt { right: 432px; }
html.guide-docked .to-top { right: 450px; }

/* everything else lives in one fixed layer above the page */
.guide-layer { position: fixed; inset: 0; pointer-events: none; z-index: 1000; font-size: 14px; }
.guide-layer [hidden] { display: none !important; }
.guide-shade { position: fixed; inset: 0; background: var(--guide-shade); }
.guide-hole { position: fixed; border-radius: 10px; box-shadow: 0 0 0 200vmax var(--guide-shade); outline: 2px solid var(--guide-accent); outline-offset: 0; transition: left 0.25s ease, top 0.25s ease, width 0.25s ease, height 0.25s ease; }
@media (prefers-reduced-motion: reduce) { .guide-hole, .guide-cursor { transition: none !important; } }

.guide-bubble { position: fixed; pointer-events: auto; background: var(--surface); color: var(--ink); border: 1.5px solid var(--guide-accent); border-radius: 12px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.22); padding: 12px 16px 10px; max-height: calc(100vh - 32px); overflow-y: auto; }
.guide-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.guide-of { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--ink-2); }
.guide-count { font-variant-numeric: tabular-nums; }
.guide-x { all: unset; cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 6px; color: var(--muted); }
.guide-x:hover, .guide-x:focus-visible { background: var(--wash); color: var(--ink); }
.guide-progress { flex-basis: 100%; height: 3px; background: var(--grid); border-radius: 2px; overflow: hidden; }
.guide-progress span { display: block; height: 100%; background: var(--guide-accent); transition: width 0.3s ease; }
.guide-title { font-weight: 650; font-size: 15px; margin: 10px 0 4px; }
.guide-rich p { margin: 6px 0; line-height: 1.45; }
.guide-rich ul { margin: 6px 0; padding-left: 20px; }
.guide-rich li { margin: 3px 0; line-height: 1.4; }
.guide-rich code { font-size: 12.5px; background: var(--wash); padding: 1px 5px; border-radius: 4px; }
.guide-note { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: var(--guide-accent-soft); font-size: 13px; }
.guide-note .guide-rich p { margin: 0; }
.guide-note.warn { background: rgba(250, 178, 25, 0.16); }
.guide-note.confirm { border: 1px dashed var(--guide-accent); background: transparent; }
.guide-elapsed { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; margin-left: auto; }
.guide-spin { flex: none; width: 12px; height: 12px; margin-top: 3px; border: 2px solid var(--guide-accent); border-right-color: transparent; border-radius: 50%; animation: guide-spin 0.8s linear infinite; }
@keyframes guide-spin { to { transform: rotate(360deg); } }
.guide-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.guide-spacer { flex: 1; }
.guide-actions button.primary { background: var(--guide-accent); color: var(--guide-accent-ink); }
.guide-actions button.primary:hover { filter: brightness(0.95); background: var(--guide-accent); }
.guide-auto { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--muted); cursor: pointer; }
.guide-checks { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.guide-checks li { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.guide-check-icon { flex: none; width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; background: var(--grid); color: var(--ink-2); }
.guide-checks li.ok .guide-check-icon { background: var(--good); color: #fff; }
.guide-checks li.bad .guide-check-icon { background: var(--critical); color: #fff; }
.guide-check-detail { color: var(--muted); font-size: 12px; word-break: break-word; }
.guide-check-fix { font-size: 12px; margin-top: 2px; }

/* the system's cursor */
.guide-cursor { position: fixed; width: 26px; height: 26px; margin: -3px 0 0 -4px; transition: left 0.5s cubic-bezier(0.3, 0.7, 0.2, 1), top 0.5s cubic-bezier(0.3, 0.7, 0.2, 1); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35)); }
.guide-cursor svg path { fill: var(--guide-accent); stroke: #fff; stroke-width: 1.4; stroke-linejoin: round; }
.guide-cursor::after { content: ''; position: absolute; left: -10px; top: -10px; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--guide-accent); opacity: 0; }
.guide-cursor.click::after { animation: guide-click 0.45s ease-out; }
@keyframes guide-click { from { opacity: 0.9; transform: scale(0.4); } to { opacity: 0; transform: scale(1.6); } }

.guide-toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: var(--page); padding: 8px 14px; border-radius: 999px; font-size: 13px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2); }

/* the panel: the checklist of lessons */
.guide-panel { position: fixed; pointer-events: auto; background: var(--surface); color: var(--ink); border: 1.5px solid var(--guide-accent); border-radius: 12px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.22); max-height: calc(100vh - 100px); display: flex; flex-direction: column; overflow: hidden; }
/* docked: a full-height sheet on the right, the page centred in the space left of it (guide.js placePanel) */
.guide-panel.docked { height: calc(100vh - 24px); box-shadow: 0 6px 28px rgba(0, 0, 0, 0.18); }
html.guide-docked { padding-right: calc(var(--guide-dock, 440px) + 24px); }
html { transition: padding-right 0.18s ease-out; }
@media (prefers-reduced-motion: reduce) { html { transition: none; } }
.guide-panel-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.guide-panel-head .guide-cap { color: var(--guide-accent); width: 22px; height: 22px; }
.guide-panel-head h2 { margin: 0; font-size: 16px; flex: 1; }
.guide-panel-count { font-size: 12px; color: var(--muted); }
.guide-panel-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 10px 8px; }
.guide-list { list-style: none; margin: 0; padding: 0; }
.guide-item { border-radius: 8px; }
.guide-item-row { display: flex; align-items: center; gap: 10px; padding: 5px 4px; }
.guide-box { flex: none; width: 18px; height: 18px; border: 1.5px solid var(--guide-accent); border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--guide-accent); }
.guide-item.done .guide-box { background: var(--guide-accent-soft); }
.guide-item-title { all: unset; flex: 1; min-width: 0; cursor: pointer; font-weight: 600; line-height: 1.3; }
.guide-item.done .guide-item-title { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.guide-item-title:focus-visible { outline: 2px solid var(--guide-accent); outline-offset: 2px; border-radius: 4px; }
.guide-node-time { text-align: right; }
.guide-time, .guide-node-time { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.guide-item.done .guide-time { opacity: .6; }
.guide-show { flex: none; font-size: 12px; padding: 3px 8px; opacity: 0; }
.guide-item:hover .guide-show, .guide-show:focus-visible, .guide-show.first, .guide-item.open .guide-show { opacity: 1; }
.guide-show.first { background: var(--guide-accent); color: var(--guide-accent-ink); border-color: transparent; }
@media (hover: none) { .guide-show { opacity: 1; } }
.guide-item-more { padding: 0 4px 8px 32px; font-size: 13px; color: var(--ink-2); }
.guide-meta { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.guide-empty { color: var(--muted); }
.guide-errors { margin: 0 14px 8px; font-size: 12px; color: var(--critical); }
.guide-errors ul { padding-left: 16px; color: var(--ink-2); }
.guide-panel-foot { flex: none; display: flex; gap: 8px; align-items: center; padding: 8px 14px 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.guide-panel-foot button.link { all: unset; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.guide-panel-foot button.link:hover, .guide-panel-foot button.link:focus-visible { color: var(--ink); }

/* the lesson tree: groups by path, each foldable, with its count and progress */
.guide-search { flex: none; margin: 10px 14px 2px; padding: 7px 10px; font: inherit; font-size: 13px; color: var(--ink); background: var(--page); border: 1px solid var(--border); border-radius: 8px; }
.guide-search:focus-visible { outline: 2px solid var(--guide-accent); outline-offset: 1px; }
.guide-node { margin: 2px 0; }
.guide-node + .guide-node { border-top: 1px solid var(--border); }
.guide-node .guide-node { border-top: 0; margin-left: 12px; }
.guide-node-head { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: 14px 1fr auto 46px 44px; align-items: center; gap: 8px; padding: 8px 4px; cursor: pointer; border-radius: 6px; }
.guide-node-head:hover { background: var(--wash); }
.guide-node-head:focus-visible { outline: 2px solid var(--guide-accent); outline-offset: 1px; }
.guide-chevron { color: var(--muted); font-size: 11px; }
.guide-node-name { font-weight: 650; }
.guide-node.depth-0 > .guide-node-head .guide-node-name { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); }
.guide-node-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.guide-node-count.all { color: var(--guide-accent); font-weight: 600; }
.guide-node-bar { height: 4px; border-radius: 2px; background: var(--grid); overflow: hidden; }
.guide-node-bar span { display: block; height: 100%; background: var(--guide-accent); }
.guide-node-body { padding: 0 0 6px 18px; }
.guide-node-text { margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.guide-node .guide-list { margin-bottom: 2px; }

/* the recorder: a bar at the bottom left while a lesson is recorded (guide-recorder.js) */
.guide-recorder { position: fixed; left: 16px; bottom: 16px; z-index: 1001; width: min(420px, calc(100vw - 32px)); max-height: min(70vh, 640px); display: flex; flex-direction: column; background: var(--surface); color: var(--ink); border: 1.5px solid var(--critical); border-radius: 12px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25); font-size: 13px; }
.guide-recorder[hidden] { display: none; }
.guide-rec-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.guide-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--critical); animation: guide-rec-blink 1.2s ease-in-out infinite; }
.guide-rec-dot.paused { animation: none; background: var(--muted); }
@keyframes guide-rec-blink { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .guide-rec-dot { animation: none; } }
.guide-rec-count { color: var(--muted); flex: 1; }
.guide-rec-fold { all: unset; cursor: pointer; padding: 0 6px; color: var(--muted); }
.guide-rec-lesson { padding: 8px 12px 0; }
.guide-rec-lesson input, .guide-rec-title, .guide-rec-text { box-sizing: border-box; width: 100%; font: inherit; color: var(--ink); background: var(--page); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; }
.guide-rec-lesson input { font-weight: 600; }
.guide-rec-list { list-style: none; margin: 0; padding: 8px 12px; overflow-y: auto; display: grid; gap: 8px; }
.guide-rec-step { display: grid; gap: 4px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; }
.guide-rec-step.ask { border-color: var(--guide-accent); }
.guide-rec-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.guide-rec-n { font-weight: 700; color: var(--ink-2); }
.guide-rec-kind { text-transform: uppercase; letter-spacing: 0.05em; }
.guide-rec-page { margin-left: auto; }
.guide-rec-del { all: unset; cursor: pointer; padding: 0 4px; font-size: 15px; }
.guide-rec-del:hover { color: var(--critical); }
.guide-rec-text { resize: vertical; }
.guide-rec-hint { margin: 8px 12px; color: var(--muted); }
.guide-rec-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--border); }
.guide-rec-actions button { font-size: 12px; padding: 4px 8px; }
.guide-rec-actions button.primary { background: var(--critical); color: #fff; }
.guide-pick { position: fixed; z-index: 1000; pointer-events: none; border: 2px dashed var(--critical); border-radius: 6px; background: rgba(208, 59, 59, 0.06); }
.guide-pick[hidden] { display: none; }
body.guide-picking, body.guide-picking * { cursor: crosshair !important; }
.guide-panel-make { justify-content: flex-start; border-top: 0; padding-top: 0; }
.guide-panel-make .guide-record { color: var(--critical); }

/* the panel's two tabs: the interactive lessons and their videos */
.guide-tabs { flex: none; display: flex; gap: 4px; padding: 8px 14px 0; border-bottom: 1px solid var(--border); }
.guide-tab { all: unset; cursor: pointer; padding: 6px 10px 7px; font-size: 13px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.guide-tab[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--guide-accent); }
.guide-tab:hover { color: var(--ink); }
.guide-tab:focus-visible { outline: 2px solid var(--guide-accent); outline-offset: -2px; border-radius: 4px; }
/* a lesson with a video: not crossed out (it is not done), its play button always visible */
.guide-item.guide-video.done .guide-item-title { text-decoration: none; color: var(--ink); font-weight: 600; }
.guide-item.guide-video.done .guide-box { font-size: 9px; }
.guide-item.guide-video.done .guide-show { opacity: 1; }
.guide-show.guide-rec { color: var(--critical); }
.guide-show:disabled { opacity: 0.4; cursor: default; }
.guide-video-list { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.guide-item-more button.link { all: unset; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; font-size: 12px; color: var(--ink-2); }
.guide-item-more button.link:hover { color: var(--ink); }
.guide-item-more button.link:disabled { opacity: 0.4; cursor: default; }
.guide-video-job { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 4px; padding: 6px 10px; border-radius: 8px; background: var(--guide-accent-soft); font-size: 12px; }
.guide-video-job.failed { background: transparent; border: 1px solid var(--critical); }
.guide-video-error { color: var(--critical); }
.guide-video-job button.link { all: unset; cursor: pointer; text-decoration: underline; }
.guide-video-job > span:not(.guide-spin) { flex: 1; min-width: 0; }

/* ---- the This screen tab: the page's help (guides/help/<page>.yaml) */
.guide-help { padding: 4px 2px 12px; font-size: 13.5px; line-height: 1.5; color: var(--ink); }
.guide-help h3 { margin: 2px 0 10px; font-size: 17px; }
.guide-help h4 { margin: 0 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--ink-2); }
.guide-help p { margin: 0 0 6px; }
.guide-help-where { margin: 0; font-size: 12px; color: var(--ink-2); }
.guide-help-block { margin: 0 0 14px; }
.guide-help-use { margin: 0; padding-left: 20px; }
.guide-help-use li { margin: 0 0 4px; }
.guide-help-fields { list-style: none; margin: 0; padding: 0; }
.guide-help-field { padding: 8px 10px; margin: 0 0 6px; border: 1px solid var(--border); border-radius: 8px; }
.guide-help-field:hover { border-color: var(--guide-accent); }
.guide-help-field p { margin: 2px 0 0; color: var(--ink-2); }
.guide-help-field-head { display: flex; align-items: baseline; gap: 8px; }
.guide-help-field-head strong { flex: 1; }
.guide-help-show { font-size: 12px; }
.guide-help-tabs { list-style: none; margin: 0; padding: 0; }
.guide-help-tabs details, .guide-help-page { margin: 0 0 6px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.guide-help-tabs summary, .guide-help-page summary { cursor: pointer; font-weight: 600; }
.guide-help-tab, .guide-help-page > div { padding-top: 8px; }
/* the field the user points at in the help, lit on the page */
.guide-help-lit { outline: 3px solid var(--guide-accent, #6d5efc) !important; outline-offset: 3px; border-radius: 4px; transition: outline-color .2s; }
