/* Shared Standalone Guide & Developer Wiki Chrome (`guide.html` & `wiki.html`) */
html:has(> body.guide-standalone-body) {
  height: auto;
  overflow-x: hidden;
  overflow-y: visible;
}
body.guide-standalone-body {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 100dvh;
  background: radial-gradient(circle at 50% 0%, #17253b 0%, #090e1a 100%);
  color: var(--text-main, #f8fafc);
  user-select: text;
  overflow-x: hidden;
  overflow-y: visible;
}
.standalone-guide-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 17, 32, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1.5px solid var(--brass-border, #b48a3e);
  padding: 0.9rem 1.5rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.65);
}
.standalone-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.standalone-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.standalone-brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: radial-gradient(circle at 30% 30%, #273754, #0f172a);
  border: 1.5px solid var(--brass-highlight, #e5c158);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}
.standalone-brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-family: var(--font-display, Georgia, serif);
  color: #fde68a;
}
.standalone-brand p {
  margin: 0.1rem 0 0 0;
  font-size: 0.82rem;
  color: var(--text-muted, #94a3b8);
}
.standalone-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.standalone-container {
  max-width: 1280px;
  width: 100%;
  margin: 1.5rem auto 3rem auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.standalone-sidebar {
  position: sticky;
  top: 5.5rem;
  background: rgba(14, 18, 28, 0.88);
  border: 1px solid rgba(180, 138, 62, 0.35);
  border-radius: 12px;
  padding: 0.85rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
}
.standalone-sidebar .guide-chapter-nav {
  border-right: none;
  padding-right: 0;
  max-height: calc(100dvh - 8rem);
}
.standalone-main {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}
.standalone-search-bar {
  background: rgba(14, 18, 28, 0.88);
  border: 1px solid rgba(180, 138, 62, 0.35);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.wiki-filter-chip {
  background: rgba(30, 41, 59, 0.85);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.wiki-filter-chip:hover,
.wiki-filter-chip.is-active {
  background: rgba(56, 189, 248, 0.2);
  color: #fde68a;
  border-color: #38bdf8;
}
@media (min-width: 641px) and (max-width: 1024px) {
  .standalone-container {
    grid-template-columns: 210px 1fr;
    gap: 1.15rem;
    padding: 0 1rem;
  }
  .standalone-brand h1 {
    font-size: clamp(1.1rem, 1rem + 0.8vw, 1.35rem);
  }
  .standalone-brand p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}
@media (max-width: 860px) {
  .standalone-container {
    grid-template-columns: 1fr;
    margin: 1rem auto 2rem auto;
    padding: 0 0.75rem calc(2rem + env(safe-area-inset-bottom, 0px));
  }
  .standalone-sidebar {
    position: sticky;
    top: calc(env(safe-area-inset-top, 0px) + 4.25rem);
    z-index: 40;
    max-height: none;
    overflow-x: auto;
    padding: 0.45rem;
  }
  .standalone-sidebar .guide-chapter-nav {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 0.4rem;
    max-height: none;
    scrollbar-width: none;
  }
  .standalone-sidebar .guide-chapter-nav::-webkit-scrollbar {
    display: none;
  }
  .standalone-sidebar .guide-nav-btn {
    flex: 0 0 auto;
    scroll-snap-align: start;
    white-space: nowrap;
    min-height: 44px;
    padding: 0.4rem 0.75rem;
    font-size: 0.82rem;
  }
}
@media (max-width: 640px), (pointer: coarse) {
  .standalone-guide-header {
    padding: calc(0.65rem + env(safe-area-inset-top, 0px)) 0.85rem 0.65rem;
  }
  .standalone-brand h1 {
    font-size: 1.05rem;
  }
  .standalone-brand p {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .standalone-actions {
    width: 100%;
    justify-content: space-between;
  }
  .standalone-actions .btn {
    flex: 1;
    min-height: 44px;
    justify-content: center;
    text-align: center;
  }
  .wiki-filter-chip {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}
@media print {
  html,
  body,
  body.guide-standalone-body {
    height: auto !important;
    overflow: visible !important;
    color: #0f172a !important;
    background: #fff !important;
  }
  .standalone-main,
  .standalone-main * {
    color: #0f172a !important;
    background: #fff !important;
    border-color: #cbd5e1 !important;
    box-shadow: none !important;
  }
  .standalone-guide-header,
  .standalone-sidebar,
  .standalone-search-bar,
  #standalone-wiki-workbench-pills,
  .wiki-sandbox-card {
    display: none !important;
  }
  .standalone-container {
    display: block;
    margin: 0;
    padding: 0;
  }
  .guide-chapter-block {
    margin-bottom: 1.5rem;
  }
  .guide-section-block,
  .guide-entry-item {
    break-inside: avoid;
  }
}
