/* Interactive walkthrough. The application owns placement and progression. */
body.tutorial-running {
  --tutorial-bg: #1b241b;
  --tutorial-border: #536842;
  --tutorial-muted: #a8b99d;
  --tutorial-accent: var(--lime, #b7ed78);
  overscroll-behavior: contain;
}

.tutorial-replay-button{display:inline-flex;align-items:center;gap:7px;border:1px solid #3f5036;border-radius:5px;background:#202b1b;padding:5px 10px;min-height:33px;margin-right:8px;font-size:11px;color:#bfd9a8;white-space:nowrap}
.tutorial-replay-button svg{width:14px;height:14px}
.tutorial-replay-button:hover{background:#314128;border-color:#687f53;color:#e0efcf}
body.tutorial-running .inspector-detail.ports-section{display:block}
@media(max-width:760px){.tutorial-replay-button{font-size:10px;gap:5px;margin-right:3px;padding:5px 7px}.topbar-right .clock,.topbar-right .clock-label{display:none}.breadcrumb strong{max-width:130px}}
@media(max-width:420px){.breadcrumb strong{max-width:95px}.breadcrumb{gap:5px}.tutorial-replay-button{margin-right:0}}

#tutorial-root {
  position: fixed;
  inset: 0;
  z-index: 110;
  pointer-events: none;
}

#tutorial-root:has(.tutorial-card.is-centered) {
  background: rgb(4 9 5 / 76%);
  backdrop-filter: blur(3px);
}

.tutorial-spotlight {
  position: fixed;
  box-sizing: border-box;
  border: 2px solid var(--tutorial-accent, #b7ed78);
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgb(4 9 5 / 76%), 0 0 24px rgb(183 237 120 / 16%);
  pointer-events: none;
  transition: top 160ms ease, left 160ms ease, width 160ms ease, height 160ms ease;
}

.tutorial-card {
  position: fixed;
  box-sizing: border-box;
  width: 350px;
  max-width: calc(100vw - 28px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--tutorial-border, #536842);
  border-radius: 10px;
  background: var(--tutorial-bg, #1b241b);
  color: #e8f0e3;
  box-shadow: 0 15px 55px rgb(0 0 0 / 48%);
  pointer-events: auto;
  font-family: var(--font, sans-serif);
  font-size: 13px;
  line-height: 1.75;
  scrollbar-width: thin;
  scrollbar-color: #61794e #1b241b;
  overscroll-behavior: contain;
  isolation: isolate;
}

.tutorial-card.is-centered {
  top: 50%;
  left: 50%;
  width: 440px;
  transform: translate(-50%, -50%);
  padding: 25px;
}

.tutorial-topline {
  position: sticky;
  top: -20px;
  z-index: 2;
  background: var(--tutorial-bg, #1b241b);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -3px 0 11px;
}

.tutorial-label {
  color: var(--tutorial-accent, #b7ed78);
  font: 10px/1.5 var(--mono, monospace);
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.tutorial-card button {
  min-height: 40px;
  border-radius: 5px;
  touch-action: manipulation;
  cursor: pointer;
  font: inherit;
}

.tutorial-card button:focus-visible {
  outline: 2px solid var(--tutorial-accent, #b7ed78);
  outline-offset: 3px;
}

.tutorial-card button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.tutorial-skip {
  flex-shrink: 0;
  min-width: 66px;
  padding: 6px 9px;
  border: 1px solid transparent;
  background: transparent;
  color: #b7c6ad;
  font-size: 11px !important;
  line-height: 1.4;
}

.tutorial-skip:hover {
  border-color: #526447;
  background: #2b3825;
  color: #f0f5e9;
}

.tutorial-progress {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 19px;
}

.tutorial-progress i {
  display: block;
  height: 3px;
  flex: 1;
  min-width: 6px;
  border-radius: 2px;
  background: #3a4932;
}

.tutorial-progress i.done {
  background: #83ab5f;
}

.tutorial-progress i.current {
  background: var(--tutorial-accent, #b7ed78);
  box-shadow: 0 0 9px rgb(183 237 120 / 25%);
}

.tutorial-card h2 {
  margin: 0 0 9px;
  color: #edf3e7;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.35px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.tutorial-card p {
  margin: 0;
  color: var(--tutorial-muted, #a8b99d);
  font-size: 13px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.tutorial-card strong {
  color: #e0edcf;
  font-weight: 550;
}

.tutorial-tip {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid #405436;
  border-radius: 5px;
  background: #25331f;
  color: #bbcfac;
  font-size: 12px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.tutorial-tip svg {
  width: 15px;
  height: 15px;
  margin-right: 5px;
  color: var(--tutorial-accent, #b7ed78);
}

.tutorial-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 19px;
  padding-top: 15px;
  border-top: 1px solid #3d4f33;
}

.tutorial-back {
  padding: 8px 10px;
  border: 1px solid #465b39;
  background: transparent;
  color: #b5c8a7;
  font-size: 12px !important;
}

.tutorial-back:hover:not(:disabled) {
  background: #2b3b23;
  color: #e6efde;
}

.tutorial-next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-left: auto;
  padding: 8px 14px;
  border: 1px solid var(--tutorial-accent, #b7ed78);
  background: var(--tutorial-accent, #b7ed78);
  color: #233518;
  font-size: 12px !important;
  font-weight: 600 !important;
}

.tutorial-next:hover:not(:disabled) {
  border-color: #d1f6a7;
  background: #c9f298;
}

.tutorial-next svg {
  width: 15px;
  height: 15px;
}

.tutorial-wait {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: #c5d9b4;
  font-size: 12px;
  line-height: 1.7;
}

.tutorial-wait::before {
  content: "";
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tutorial-accent, #b7ed78);
  box-shadow: 0 0 0 4px rgb(183 237 120 / 8%);
  animation: tutorial-pulse 2s ease-in-out infinite;
}

.tutorial-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 4px 0 19px;
  border: 1px solid #526f3c;
  border-radius: 12px;
  background: #2c3e21;
  color: var(--tutorial-accent, #b7ed78);
}

.tutorial-hero svg {
  width: 28px;
  height: 28px;
  stroke-width: 1.6;
}

.tutorial-checklist {
  display: grid;
  gap: 9px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.tutorial-checklist li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: #b4c9a3;
  font-size: 13px;
  line-height: 1.75;
}

.tutorial-checklist li svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 3px;
  color: var(--tutorial-accent, #b7ed78);
}

.tutorial-active-target {
  outline: 2px solid var(--tutorial-accent, #b7ed78) !important;
  outline-offset: 5px !important;
  scroll-margin-top: 130px;
  scroll-margin-bottom: 210px;
}

.tutorial-inline {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid #607c48;
  background: var(--tutorial-bg, #1b241b);
  box-shadow: 0 9px 16px rgb(0 0 0 / 18%);
  pointer-events: auto;
}

.tutorial-inline .tutorial-card {
  position: static;
  inset: auto;
  width: 100%;
  max-width: none;
  max-height: min(340px, 46dvh);
  margin: 0;
  padding: 14px 20px 15px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transform: none;
}

.tutorial-inline .tutorial-topline {
  position: sticky;
  top: -14px;
  z-index: 1;
  margin: -3px -2px 5px;
  padding: 0 2px;
  background: var(--tutorial-bg, #1b241b);
}

.tutorial-inline .tutorial-progress {
  margin-bottom: 11px;
}

.tutorial-inline .tutorial-card h2 {
  margin-bottom: 5px;
  font-size: 16px;
}

.tutorial-inline .tutorial-card p,
.tutorial-inline .tutorial-tip,
.tutorial-inline .tutorial-wait {
  font-size: 12px;
}

.tutorial-inline .tutorial-tip {
  margin-top: 8px;
  padding: 7px 10px;
}

.tutorial-inline .tutorial-footer {
  margin-top: 11px;
  padding-top: 10px;
}

.tutorial-inline .tutorial-wait {
  margin-top: 9px;
}

@keyframes tutorial-pulse {
  50% { opacity: .65; box-shadow: 0 0 0 6px rgb(183 237 120 / 3%); }
}

@media (max-width: 600px) {
  .tutorial-card {
    width: 350px;
    max-width: calc(100vw - 24px);
    padding: 16px;
    border-radius: 8px;
    max-height: calc(100dvh - 24px);
  }

  .tutorial-card.is-centered {
    padding: 21px;
    max-height: calc(100dvh - 24px);
  }

  .tutorial-card h2 { font-size: 17px; }
  .tutorial-topline { top: -16px; }
  .tutorial-card p { font-size: 12px; line-height: 1.85; }
  .tutorial-label { font-size: 9px; letter-spacing: .8px; }
  .tutorial-progress { margin-bottom: 14px; }
  .tutorial-footer { margin-top: 15px; padding-top: 12px; }
  .tutorial-tip { margin-top: 11px; font-size: 12px; }
  .tutorial-hero { width: 48px; height: 48px; margin-bottom: 14px; }
  .tutorial-checklist { gap: 8px; margin-top: 14px; }
  .tutorial-checklist li { font-size: 12px; }
  .tutorial-inline .tutorial-card { padding: 11px 16px 12px; max-height: 43dvh; }
  .tutorial-inline .tutorial-topline { top: -11px; }
  .tutorial-inline .tutorial-card h2 { font-size: 15px; }
  .tutorial-inline .tutorial-card p { font-size: 12px; }
  .tutorial-inline .tutorial-footer { margin-top: 9px; padding-top: 8px; }
}

@media(max-width:799px){body.tutorial-running .app-shell{padding-bottom:50dvh}}

@media (max-height: 600px) {
  .tutorial-card { padding: 14px 17px; }
  .tutorial-card.is-centered { padding: 17px 21px; }
  .tutorial-topline { margin-bottom: 5px; }
  .tutorial-progress { margin-bottom: 10px; }
  .tutorial-hero { width: 40px; height: 40px; margin-bottom: 10px; }
  .tutorial-hero svg { width: 22px; height: 22px; }
  .tutorial-card h2 { font-size: 16px; }
  .tutorial-checklist { margin-top: 10px; gap: 5px; }
  .tutorial-tip { margin-top: 9px; padding: 7px 10px; }
  .tutorial-footer { margin-top: 11px; padding-top: 9px; }
  .tutorial-inline .tutorial-card { max-height: 48dvh; }
}

@media (prefers-reduced-motion: reduce) {
  .tutorial-spotlight,
  .tutorial-wait::before { animation: none; transition: none; }
}
