/* ── Tour overlay (SVG-based spotlight) ───────────────────────── */
#tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: all;
}

/* smooth hole transition */
#tour-hole {
  transition: x 0.28s ease, y 0.28s ease, width 0.28s ease, height 0.28s ease;
}

/* ── Spotlight ring ───────────────────────────────────────────── */
#tour-ring {
  position: fixed;
  z-index: 9001;
  pointer-events: none;
  border: 2px solid rgba(63, 185, 80, 0.55);
  border-radius: 8px;
  box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.12);
  transition: all 0.28s ease;
}

/* ── Tooltip card ─────────────────────────────────────────────── */
#tour-tooltip {
  position: fixed;
  z-index: 9002;
  width: 290px;
  background: #161b22;
  border: 1px solid rgba(63, 185, 80, 0.35);
  border-radius: 10px;
  padding: 18px;
  box-shadow:
    0 0 0 1px rgba(63, 185, 80, 0.07),
    0 14px 42px rgba(0, 0, 0, 0.7);
  color: #e6edf3;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 13px;
  pointer-events: all;
}

/* re-trigger animation by toggling the class */
#tour-tooltip.tt-animate {
  animation: tour-tt-fade 0.22s ease both;
}

@keyframes tour-tt-fade {
  from { opacity: 0; filter: blur(3px); transform: translateY(4px); }
  to   { opacity: 1; filter: blur(0);   transform: translateY(0);   }
}

/* ── Welcome / done card (centered) ──────────────────────────── */
#tour-tooltip.tt-center {
  width: 340px;
  text-align: center;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* ── Top bar: counter + skip ──────────────────────────────────── */
.tt-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  min-height: 20px;
}

.tt-counter {
  font-size: 10px;
  color: #8b949e;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid #30363d;
  padding: 2px 8px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

.tt-skip {
  font-size: 11px;
  color: #8b949e;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  font-family: inherit;
  transition: color 0.15s;
  margin-left: auto;
}
.tt-skip:hover { color: #f85149; }

/* ── Tooltip logo (welcome only) ──────────────────────────────── */
.tt-logo {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: linear-gradient(135deg, #4393c3, #9b59b6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  margin: 0 auto 14px;
  letter-spacing: 0.5px;
}

/* ── Tooltip body ─────────────────────────────────────────────── */
.tt-heading {
  font-size: 14px;
  font-weight: 700;
  color: #e6edf3;
  margin-bottom: 8px;
  line-height: 1.3;
}

.tt-body {
  font-size: 12.5px;
  color: #8b949e;
  line-height: 1.65;
  margin-bottom: 16px;
}

.tt-body strong { color: #c9d1d9; font-weight: 600; }

.tt-body a {
  color: #3fb950;
  text-decoration: none;
}
.tt-body a:hover { text-decoration: underline; }

.tt-credit {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #21262d;
  font-size: 11px;
  color: #6e7681;
  line-height: 1.6;
  text-align: left;
}

.tt-credit a {
  color: #3fb950;
  text-decoration: none;
}
.tt-credit a:hover { text-decoration: underline; }

/* ── Action buttons ───────────────────────────────────────────── */
.tt-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.tt-actions.tt-actions-center {
  flex-direction: column;
  gap: 10px;
}

.tt-btn {
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}

.tt-start {
  background: rgba(63, 185, 80, 0.1);
  border: 1.5px solid rgba(63, 185, 80, 0.45);
  color: #3fb950;
  width: 100%;
  padding: 9px 16px;
  font-size: 13px;
}
.tt-start:hover {
  background: rgba(63, 185, 80, 0.18);
  border-color: #3fb950;
}

.tt-skip-intro {
  background: none;
  border: none;
  color: #6e7681;
  font-size: 11.5px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-family: inherit;
  padding: 0;
  transition: color 0.15s;
}
.tt-skip-intro:hover { color: #8b949e; }

.tt-back {
  background: transparent;
  border: 1.5px solid #30363d;
  color: #8b949e;
}
.tt-back:hover {
  border-color: #8b949e;
  color: #e6edf3;
}

.tt-fwd {
  background: rgba(63, 185, 80, 0.1);
  border: 1.5px solid rgba(63, 185, 80, 0.45);
  color: #3fb950;
  margin-left: auto;
}
.tt-fwd:hover {
  background: rgba(63, 185, 80, 0.18);
  border-color: #3fb950;
}

/* ── Tour help (?) button ─────────────────────────────────────── */
#tour-help-btn {
  position: fixed;
  bottom: 60px;
  right: 14px;
  z-index: 8999;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(22, 27, 34, 0.92);
  border: 1.5px solid #30363d;
  color: #8b949e;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: border-color 0.15s, color 0.15s, transform 0.1s;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
#tour-help-btn:hover {
  border-color: #3fb950;
  color: #3fb950;
  transform: scale(1.07);
}
#tour-help-btn.tour-running { display: none; }

/* ── Shared console tour language ─────────────────────────────── */
#tour-overlay {
  font-family: var(--font-mono, 'IBM Plex Mono', ui-monospace, monospace);
}

#tour-hole {
  rx: 0;
  ry: 0;
}

#tour-ring {
  border: 1.5px solid var(--accent-3, oklch(0.83 0.135 82 / .45));
  border-radius: 0;
  box-shadow: 0 0 0 2px var(--accent-2, oklch(0.83 0.135 82 / .16));
}

#tour-tooltip {
  width: 304px;
  border-radius: 0;
  padding: 0;
  background: var(--surface, oklch(0.182 0.009 250));
  border: 1px solid var(--border, oklch(0.31 0.012 250));
  color: var(--text, oklch(0.93 0.008 250));
  font-family: var(--font-mono, 'IBM Plex Mono', ui-monospace, monospace);
  font-size: 11px;
  box-shadow: 0 22px 54px -16px oklch(0 0 0 / .88);
  overflow: hidden;
}

#tour-tooltip::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 3px, oklch(1 0 0 / .006) 3px 4px);
}

#tour-tooltip > * { position: relative; z-index: 1; }

#tour-tooltip.tt-center {
  width: min(370px, calc(100vw - 32px));
  text-align: left;
}

#tour-tooltip.tt-welcome {
  width: min(430px, calc(100vw - 32px));
}

.tt-logo {
  width: 42px;
  height: 42px;
  border-radius: 0;
  border: 1px solid var(--accent, oklch(0.83 0.135 82));
  background: var(--bg, oklch(0.15 0.008 250));
  color: var(--accent, oklch(0.83 0.135 82));
  overflow: hidden;
  position: relative;
  margin: 16px 20px 0;
}

.tt-logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.tt-logo-bbox {
  position: absolute;
  left: 11px;
  top: 12px;
  width: 18px;
  height: 15px;
  border: 1.5px solid var(--accent, oklch(0.83 0.135 82));
  box-shadow:
    0 0 0 1px oklch(0 0 0 / .5),
    inset 0 0 0 999px oklch(from var(--accent) l c h / .08);
}

.tt-logo-bbox::before {
  content: "";
  position: absolute;
  left: -2px;
  top: -2px;
  width: 3px;
  height: 3px;
  background: var(--accent, oklch(0.83 0.135 82));
  box-shadow:
    15px 0 0 var(--accent, oklch(0.83 0.135 82)),
    0 12px 0 var(--accent, oklch(0.83 0.135 82)),
    15px 12px 0 var(--accent, oklch(0.83 0.135 82));
}

.tt-heading {
  font-family: var(--font-cond, 'IBM Plex Sans Condensed', 'IBM Plex Mono', sans-serif);
  font-size: 16px;
  letter-spacing: .02em;
  color: var(--text, oklch(0.93 0.008 250));
  margin: 0;
  padding: 14px 16px 0;
}

.tt-body {
  margin: 0;
  padding: 12px 16px 16px;
  font-size: 11.5px;
  letter-spacing: .015em;
  line-height: 1.72;
  color: var(--text-2, oklch(0.71 0.011 250));
}

.tt-welcome .tt-logo {
  width: 54px;
  height: 54px;
  margin: 18px auto 0;
}

.tt-welcome .tt-logo-bbox {
  left: 14px;
  top: 15px;
  width: 23px;
  height: 19px;
}

.tt-welcome .tt-logo-bbox::before {
  box-shadow:
    20px 0 0 var(--accent, oklch(0.83 0.135 82)),
    0 16px 0 var(--accent, oklch(0.83 0.135 82)),
    20px 16px 0 var(--accent, oklch(0.83 0.135 82));
}

.tt-welcome .tt-heading {
  padding: 14px 22px 0;
  text-align: center;
  font-size: 22px;
  line-height: 1.05;
}

.tt-welcome .tt-body {
  padding: 9px 24px 18px;
  text-align: center;
  font-size: 12px;
  line-height: 1.7;
}

.tt-welcome .tt-credit {
  text-align: center;
  padding: 12px 18px;
}

.tt-body strong,
.tt-body code,
.tt-body kbd {
  color: var(--text, oklch(0.93 0.008 250));
}

.tt-body a,
.tt-credit a {
  color: var(--accent, oklch(0.83 0.135 82));
}

.tt-credit {
  margin: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--border, oklch(0.31 0.012 250));
  color: var(--muted, oklch(0.54 0.012 250));
  font-size: 10.5px;
  line-height: 1.6;
}

.tt-topbar {
  margin: 0;
  padding: 9px 13px 8px;
  border-bottom: 1px solid var(--border, oklch(0.31 0.012 250));
}

.tt-counter {
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--accent, oklch(0.83 0.135 82));
  padding: 0;
  font-size: 9px;
  letter-spacing: .16em;
}

.tt-skip {
  color: var(--muted, oklch(0.54 0.012 250));
  text-transform: uppercase;
  letter-spacing: .12em;
}

.tt-skip:hover {
  color: var(--accent, oklch(0.83 0.135 82));
}

.tt-actions {
  padding: 0;
  border-top: 1px solid var(--border, oklch(0.31 0.012 250));
}

.tt-actions.tt-actions-center {
  padding: 0;
  gap: 0;
}

.tt-btn,
.tt-start,
.tt-fwd,
.tt-back {
  height: 36px;
  border-radius: 0;
  border: 0;
  border-left: 1px solid var(--border, oklch(0.31 0.012 250));
  background: transparent;
  color: var(--muted, oklch(0.54 0.012 250));
  font-family: inherit;
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.tt-btn:first-child { border-left: 0; }
.tt-start,
.tt-fwd {
  background: var(--bg-3, oklch(0.225 0.011 250));
  color: var(--text, oklch(0.93 0.008 250));
}

.tt-start:hover,
.tt-fwd:hover,
.tt-back:hover {
  background: var(--accent-2, oklch(0.83 0.135 82 / .16));
  color: var(--accent, oklch(0.83 0.135 82));
  border-color: var(--accent, oklch(0.83 0.135 82));
}

.tt-skip-intro {
  width: 100%;
  height: 36px;
  border-top: 1px solid var(--border, oklch(0.31 0.012 250));
  color: var(--muted, oklch(0.54 0.012 250));
  font-family: inherit;
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
}

.tt-skip-intro:hover { color: var(--text-2, oklch(0.71 0.011 250)); }

#tour-help-btn {
  top: 64px;
  right: 16px;
  bottom: auto;
  width: 32px;
  height: 32px;
  border-radius: 0;
  border: 1px solid var(--border, oklch(0.31 0.012 250));
  background: oklch(from var(--surface) l c h / .86);
  color: var(--text-2, oklch(0.71 0.011 250));
  box-shadow: var(--shadow, 0 18px 50px -24px oklch(0 0 0 / .85));
  transform: none;
}

#tour-help-btn:hover {
  color: var(--accent, oklch(0.83 0.135 82));
  border-color: var(--accent, oklch(0.83 0.135 82));
  transform: none;
}

body.mode-3d #tour-help-btn {
  display: none;
}
