html.guide-html {
  scroll-padding-top: 80px;
}

html.guide-html h2[id],
html.guide-html h3[id] {
  scroll-margin-top: 80px;
}

html.guide-html,
body.guide-body {
  background-color: #f9fafb;
  color: #111827;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  /* Override global studio.css overflow: hidden */
  overflow-x: hidden !important;
  overflow-y: auto !important;
  height: auto !important;
}

/* Navbar / Header */
.guide-nav {
  background: white;
  border-bottom: 1px solid #f3f4f6;
  padding: 16px 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
}

.guide-nav-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.guide-nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.125rem;
  color: #111827;
}

.guide-nav-logo img {
  width: 32px;
  height: 32px;
}

.guide-nav-right {
  display: flex;
  align-items: center;
  flex: 1;
  justify-content: flex-end;
  min-width: 0;
}

.guide-nav-left {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.guide-nav-logo span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Searchable Guide Selector */
.guide-nav-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 2;
  min-width: 0;
  padding: 0 16px;
}

.guide-selector-wrapper {
  position: relative;
  width: 100%;
  max-width: 280px;
}

.guide-selector-btn {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  padding: 8px 16px;
  border-radius: 10px;
  color: #111827;
  font-weight: 600;
  font-size: 0.9375rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  font-family: inherit;
}

.guide-selector-btn:hover {
  background: #ffffff;
  border-color: #4f46e5;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.guide-selector-btn svg {
  color: #9ca3af;
  transition: transform 0.2s;
}

/* Dropdown */
.guide-selector-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  padding: 12px;
  z-index: 1000;
}

.guide-selector-dropdown.hidden {
  display: none !important;
}

/* Search Box */
.search-box {
  margin-bottom: 12px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 10px 12px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.875rem;
  color: #111827;
  transition: all 0.2s;
  box-sizing: border-box;
}

.search-box input:focus {
  outline: none;
  border-color: #4f46e5;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Guide List */
.guide-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
}

/* Scrollbar styling */
.guide-list::-webkit-scrollbar {
  width: 4px;
}
.guide-list::-webkit-scrollbar-track {
  background: transparent;
}
.guide-list::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 10px;
}

.guide-item {
  text-decoration: none;
  color: #4b5563;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.guide-item:hover {
  background: #f3f4f6;
  color: #111827;
}

.guide-item.active {
  background: #eef2ff;
  color: #4f46e5;
  font-weight: 600;
}

.guide-item.hidden {
  display: none !important;
}

.language-switcher-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #6b7280;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.language-switcher-link:hover {
  color: #4f46e5;
  background: #f3f4f6;
}



.guide-main {
  flex-grow: 1;
  width: 100%;
  max-width: 800px;
  margin: 40px auto;
  padding: 72px 20px 0;
}

/* --- Table of Contents --- */
.guide-toc {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 32px;
}

.guide-toc-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin-bottom: 12px;
}

.guide-toc ul,
.guide-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc-section;
}

.guide-toc li {
  margin: 0;
  padding: 0;
  counter-increment: toc-section;
}

.guide-toc li a {
  display: block;
  padding: 5px 0;
  color: #374151;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s;
}

.guide-toc li a::before {
  content: counter(toc-section) ". ";
  color: #9ca3af;
  font-weight: 600;
}

.guide-toc li a:hover {
  color: #6366f1;
}

.guide-toc li.toc-sub {
  counter-increment: none;
}

.guide-toc li.toc-sub a {
  padding-left: 20px;
  font-weight: 400;
  font-size: 0.8125rem;
  color: #6b7280;
}

.guide-toc li.toc-sub a::before {
  content: "— ";
  color: #d1d5db;
  font-weight: 400;
}

.guide-toc li.toc-sub a:hover {
  color: #6366f1;
}

.guide-card-content {
  background-color: #ffffff;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border: 1px solid #f3f4f6;
  padding: 40px 48px;
}

.guide-footer {
  background-color: #ffffff;
  border-top: 1px solid #e5e7eb;
  padding: 24px 0;
  margin-top: 48px;
  text-align: center;
  color: #6b7280;
  font-size: 0.875rem;
}

/* Typography & Markdown replacements */
.guide-card-content h1 {
  font-size: 2.25rem;
  font-weight: 800;
  color: #111827;
  margin: 0 0 16px 0;
  line-height: 1.2;
}

.guide-card-content h1,
.guide-card-content h2,
.guide-card-content h3 {
  scroll-margin-top: 100px;
}

.guide-card-content h2:hover .anchor-link,
.guide-card-content h3:hover .anchor-link {
  opacity: 1;
}

.anchor-link {
  opacity: 0;
  margin-left: 8px;
  color: #a5b4fc;
  text-decoration: none;
  font-weight: 400;
  font-size: 0.8em;
  transition: opacity 0.2s, color 0.2s;
}

.anchor-link:hover {
  color: #4f46e5 !important;
}

.guide-card-content h2 {
  font-size: 1.625rem;
  font-weight: 700;
  color: #1f2937;
  margin: 32px 0 16px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1.3;
}

.guide-card-content h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin: 20px 0 8px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.guide-card-content p {
  font-size: 1.0625rem;
  color: #4b5563;
  line-height: 1.55;
  margin: 0 0 12px 0;
}

.guide-card-content p.lead {
  font-size: 1.25rem;
  color: #4b5563;
  margin-bottom: 24px;
  line-height: 1.55;
}

.guide-card-content hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 24px 0;
}

.guide-card-content ul,
.guide-card-content ol {
  margin: 8px 0 20px 24px;
  color: #4b5563;
  line-height: 1.55;
}

.guide-card-content li {
  margin-bottom: 8px;
}

.guide-card-content li:last-child {
  margin-bottom: 0;
}

.guide-card-content strong {
  color: #111827;
  font-weight: 600;
}

.guide-card-content code {
  background-color: #f3f4f6;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  color: #374151;
  border: 1px solid #e5e7eb;
}

/* Layout Blocks */
.guide-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
@media (min-width: 640px) {
  .guide-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.guide-box {
  background-color: #ffffff;
  border: 1px solid #f3f4f6;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.guide-box-indigo {
  background-color: #eef2ff;
  border: 1px solid #e0e7ff;
  padding: 24px;
  border-radius: 12px;
}

.guide-box-indigo h3 { color: #312e81; }
.guide-box-indigo p, .guide-box-indigo li { color: #3730a3; }
.guide-box-indigo code { background-color: #ffffff; color: #4f46e5; border: 1px solid #c7d2fe; }

.guide-box-gray {
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  padding: 24px;
  border-radius: 12px;
}

.guide-box-red {
  background-color: #fef2f2;
  border: 2px solid #fca5a5;
  padding: 24px;
  border-radius: 12px;
}
.guide-box-red h3 { color: #991b1b; }
.guide-box-red p, .guide-box-red li { color: #7f1d1d; }
.guide-box-red code { background-color: #ffffff; color: #dc2626; border: 1px solid #fecaca; }

.guide-box-blue {
  background-color: #eff6ff;
  border: 2px solid #93c5fd;
  padding: 24px;
  border-radius: 12px;
}
.guide-box-blue h3 { color: #1e3a5f; }
.guide-box-blue p, .guide-box-blue li { color: #1e40af; }
.guide-box-blue code { background-color: #ffffff; color: #2563eb; border: 1px solid #bfdbfe; }

/* Number Badges for steps */
.step-badge {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #4f46e5;
  color: white;
  border-radius: 50%;
  font-size: 0.875rem;
  font-weight: 700;
}

/* Code Blocks */
.guide-code-block {
  background-color: #111827;
  padding: 16px;
  border-radius: 12px;
  overflow-x: auto;
  margin: 16px 0 24px 0;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.guide-code-block pre {
  margin: 0;
  color: #d1d5db;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875rem;
  line-height: 1.5;
}

.guide-code-block .token-var { color: #4ade80; }
.guide-code-block .token-string { color: #fef08a; }
.guide-code-block .token-key { color: #a5b4fc; }

/* Tip Box */
.guide-tip {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
  text-align: center;
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

/* Guide Screenshots */
.guide-screenshot {
  margin: 20px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.guide-screenshot img {
  width: 100%;
  height: auto;
  display: block;
}

.guide-screenshot-caption {
  background: #f9fafb;
  padding: 12px 16px;
  font-size: 0.8125rem;
  color: #6b7280;
  text-align: center;
  border-top: 1px solid #f3f4f6;
  line-height: 1.4;
}

.guide-screenshot-caption strong {
  color: #374151;
}

/* Source Link */
.guide-source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: #6b7280;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  transition: all 0.2s;
  margin-top: 8px;
}

.guide-source-link:hover {
  color: #4f46e5;
  border-color: #c7d2fe;
  background: #eef2ff;
}

/* Illustration images (generated) */
.guide-illustration {
  margin: 16px 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.guide-illustration img {
  width: 100%;
  max-width: 400px;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* --- Guides Responsive --- */
@media (max-width: 768px) {
  .guide-nav-container {
    padding: 0 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .guide-nav-logo {
    font-size: 1rem;
    gap: 8px;
  }

  .guide-nav-logo img {
    width: 28px;
    height: 28px;
  }

  .guide-nav-center {
    order: 3;
    flex: 0 0 100%;
    padding: 8px 0 0;
  }

  .guide-selector-wrapper {
    max-width: 100%;
  }

  .guide-main {
    margin: 24px auto;
    padding: 0 12px;
  }

  .guide-card-content {
    padding: 24px 20px;
    border-radius: 12px;
  }

  .guide-card-content h1 {
    font-size: 1.75rem;
  }

  .guide-card-content h2 {
    font-size: 1.375rem;
    margin: 24px 0 12px 0;
  }

  .guide-card-content h3 {
    font-size: 1.125rem;
  }

  .guide-card-content p {
    font-size: 1rem;
  }

  .guide-card-content p.lead {
    font-size: 1.125rem;
  }

  .guide-box,
  .guide-box-indigo,
  .guide-box-gray {
    padding: 18px;
  }

  .guide-code-block {
    padding: 14px;
    border-radius: 10px;
  }

  .guide-footer {
    margin-top: 32px;
    padding: 20px 16px;
  }
}

@media (max-width: 480px) {
  .guide-nav-container {
    padding: 0 12px;
  }

  .guide-card-content {
    padding: 20px 16px;
  }

  .guide-card-content h1 {
    font-size: 1.5rem;
  }

  .guide-card-content h2 {
    font-size: 1.25rem;
    gap: 8px;
  }

  .guide-card-content h3 {
    font-size: 1rem;
    gap: 8px;
  }

  .guide-card-content p {
    font-size: 0.9375rem;
  }

  .guide-box,
  .guide-box-indigo,
  .guide-box-gray {
    padding: 14px;
  }

  .guide-code-block pre {
    font-size: 0.8125rem;
  }

  .language-switcher-link {
    padding: 4px 8px;
    font-size: 0.75rem;
  }
}
