:root {
  --bg-left: #1721a9;
  --bg-right: #6b1cff;
  --text-main: #f4f7ff;
  --text-dim: rgba(229, 236, 255, 0.75);
  --text-faint: rgba(229, 236, 255, 0.55);
  --magenta: #ba47ff;
  --cyan-strong: #00a7ff;
  --hero-gradient-start: #7bf2ff;
  --hero-gradient-mid: #2793ff;
  --hero-gradient-end: #694bff;
  --guide-font-family: "Roboto", sans-serif;
  --guide-accent: #61c8ff;
  --guide-accent-strong: #2793ff;
  --guide-code-bg: rgba(4, 6, 24, 0.72);
  --guide-code-border: rgba(123, 242, 255, 0.16);
  --guide-mark-bg: rgba(123, 242, 255, 0.28);
  --guide-header-height: 64px;
  --guide-max-width: 1280px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
  background:
    radial-gradient(circle at 18% 42%, rgba(56, 215, 255, 0.16), transparent 30%),
    radial-gradient(circle at 82% 42%, rgba(186, 71, 255, 0.18), transparent 28%),
    linear-gradient(90deg, #05031a 0%, var(--bg-left) 34%, var(--bg-right) 70%, #140120 100%);
  background-attachment: fixed;
}

body {
  font-family: var(--guide-font-family);
  color: var(--text-main);
  position: relative;
  line-height: 1.6;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 0% 0%, rgba(0, 0, 0, 0.7) 0, rgba(0, 0, 0, 0.5) 18%, rgba(0, 0, 0, 0.18) 34%, transparent 52%),
    radial-gradient(circle at 100% 0%, rgba(0, 0, 0, 0.7) 0, rgba(0, 0, 0, 0.5) 18%, rgba(0, 0, 0, 0.18) 34%, transparent 52%),
    radial-gradient(circle at 0% 100%, rgba(0, 0, 0, 0.78) 0, rgba(0, 0, 0, 0.56) 18%, rgba(0, 0, 0, 0.2) 34%, transparent 52%),
    radial-gradient(circle at 100% 100%, rgba(0, 0, 0, 0.78) 0, rgba(0, 0, 0, 0.56) 18%, rgba(0, 0, 0, 0.2) 34%, transparent 52%);
}

a {
  color: var(--guide-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  display: block;
  max-width: 100%;
}

.guide-shell {
  position: relative;
  z-index: 1;
}

/* ---------- Header ---------- */

.guide-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  min-height: var(--guide-header-height);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  --glass-radius: 0;
  --glass-background: rgba(7, 10, 34, 0.82);
  --glass-border: 0;
}

.guide-header-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.guide-header-brand-logo {
  display: block;
  height: 24px;
  width: auto;
}

.guide-header-brand-mark {
  display: block;
  height: 36px;
  width: auto;
  filter: drop-shadow(0 0 10px rgba(123, 242, 255, 0.48)) drop-shadow(0 0 22px rgba(105, 75, 255, 0.34));
}

.guide-header-eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.guide-header-spacer {
  flex: 1 1 auto;
}

.guide-header-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 9px 22px;
  border: 0;
  border-radius: 999px;
  font-family: var(--guide-font-family);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(135deg, #2764ff 0%, #675bff 58%, #9165ff 100%);
  box-shadow: 0 12px 30px rgba(39, 100, 255, 0.32);
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.2s ease;
}

.guide-header-cta:hover,
.guide-header-cta:focus-visible {
  text-decoration: none;
  filter: brightness(1.06);
  transform: translateY(-1px);
}

@media (max-width: 640px) {
  .guide-header-eyebrow {
    display: none;
  }
}

/* ---------- Hero ---------- */

.guide-hero {
  max-width: var(--guide-max-width);
  margin: 0 auto;
  padding: clamp(32px, 6vw, 72px) clamp(16px, 4vw, 40px) 8px;
}

.guide-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  font-weight: 800;
  line-height: 1.1;
  background: linear-gradient(178deg, var(--hero-gradient-start) 10%, var(--hero-gradient-mid) 60%, var(--hero-gradient-end) 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.guide-hero p {
  margin: 0;
  max-width: 760px;
  font-size: clamp(1rem, 1.4vw, 1.14rem);
  color: var(--text-dim);
}

/* ---------- Search ---------- */

.guide-search-wrap {
  position: sticky;
  top: var(--guide-header-height);
  z-index: 15;
  max-width: var(--guide-max-width);
  margin: 20px auto 0;
  padding: 12px clamp(16px, 4vw, 40px);
}

.guide-search {
  position: relative;
  display: flex;
  align-items: center;
  --glass-radius: 999px;
  --glass-background: rgba(7, 10, 34, 0.86);
  padding: 6px 6px 6px 18px;
}

.guide-search-icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  opacity: 0.7;
}

.guide-search-input {
  flex: 1 1 auto;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 12px;
}

.guide-search-input::placeholder {
  color: var(--text-faint);
}

.guide-search-clear {
  flex: 0 0 auto;
  border: 0;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  font-size: 1.2rem;
  line-height: 1;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.guide-search-clear:hover {
  background: rgba(255, 255, 255, 0.16);
}

.guide-search-count {
  max-width: var(--guide-max-width);
  margin: 6px auto 0;
  padding: 0 clamp(16px, 4vw, 40px);
  font-size: 0.85rem;
  color: var(--text-faint);
  min-height: 1.2em;
}

/* ---------- Layout ---------- */

.guide-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: clamp(24px, 4vw, 48px);
  max-width: var(--guide-max-width);
  margin: 0 auto;
  padding: 16px clamp(16px, 4vw, 40px) 80px;
  align-items: start;
}

/* ---------- Sidebar TOC ---------- */

.guide-toc {
  position: sticky;
  top: calc(var(--guide-header-height) + 88px);
  max-height: calc(100vh - var(--guide-header-height) - 108px);
  overflow-y: auto;
  padding: 18px 16px;
  --glass-radius: 18px;
}

.guide-toc-heading {
  margin: 0 0 12px;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.guide-toc-group {
  margin-bottom: 14px;
}

.guide-toc-group-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--guide-accent);
  margin: 0 0 6px;
  padding: 0 8px;
}

.guide-toc-link {
  display: block;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--text-dim);
  border-left: 2px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.guide-toc-link:hover {
  text-decoration: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
}

.guide-toc-link.is-active {
  color: var(--text-main);
  background: rgba(39, 100, 255, 0.18);
  border-left-color: var(--guide-accent);
}

.guide-toc-link[hidden],
.guide-toc-group[hidden] {
  display: none;
}

/* ---------- Content ---------- */

.guide-content {
  min-width: 0;
}

.guide-section {
  margin-bottom: 20px;
  padding: clamp(20px, 3vw, 32px);
  scroll-margin-top: calc(var(--guide-header-height) + 100px);
  --glass-radius: 20px;
}

.guide-section[hidden] {
  display: none;
}

.guide-section > h2 {
  margin: 0 0 6px;
  font-size: clamp(1.4rem, 2.4vw, 1.8rem);
  font-weight: 800;
}

.guide-section > h3 {
  margin: 26px 0 10px;
  font-size: 1.16rem;
  font-weight: 700;
  color: #dbe6ff;
}

.guide-section-lead {
  margin: 0 0 18px;
  color: var(--text-dim);
  font-size: 1.02rem;
}

.guide-section p {
  color: var(--text-dim);
}

.guide-section strong {
  color: var(--text-main);
}

.guide-section ul,
.guide-section ol {
  color: var(--text-dim);
  padding-left: 22px;
}

.guide-section li {
  margin: 6px 0;
}

.guide-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.guide-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(39, 100, 255, 0.16);
  border: 1px solid rgba(123, 242, 255, 0.24);
  color: #cfe6ff;
}

.guide-note {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 14px;
  border-left: 3px solid var(--guide-accent);
  background: rgba(39, 100, 255, 0.12);
  color: var(--text-dim);
  font-size: 0.95rem;
}

.guide-note strong {
  color: #dbe6ff;
}

.guide-note.is-warning {
  border-left-color: var(--magenta);
  background: rgba(186, 71, 255, 0.12);
}

/* ---------- Code ---------- */

.guide-code {
  position: relative;
  margin: 14px 0;
}

.guide-code pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  border-radius: 14px;
  background: var(--guide-code-bg);
  border: 1px solid var(--guide-code-border);
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
  font-size: 0.86rem;
  line-height: 1.55;
  color: #e6f0ff;
}

.guide-code code {
  font-family: inherit;
  white-space: pre;
}

p code,
li code,
td code {
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
  font-size: 0.86em;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(4, 6, 24, 0.6);
  border: 1px solid rgba(123, 242, 255, 0.16);
  color: #cfe6ff;
  white-space: nowrap;
}

.guide-code-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(7, 10, 34, 0.8);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.guide-code-copy:hover {
  background: rgba(39, 100, 255, 0.28);
  color: #fff;
}

/* ---------- Tables ---------- */

.guide-table-wrap {
  margin: 14px 0;
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

table.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 520px;
}

.guide-table th,
.guide-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: top;
  color: var(--text-dim);
}

.guide-table th {
  background: rgba(4, 6, 24, 0.5);
  color: #dbe6ff;
  font-weight: 700;
  position: sticky;
  top: 0;
}

.guide-table tr:last-child td {
  border-bottom: 0;
}

/* ---------- Search highlight ---------- */

mark.guide-hit {
  background: var(--guide-mark-bg);
  color: #fff;
  border-radius: 3px;
  padding: 0 2px;
}

.guide-empty {
  max-width: var(--guide-max-width);
  margin: 0 auto;
  padding: 40px clamp(16px, 4vw, 40px);
  text-align: center;
  color: var(--text-dim);
}

.guide-empty[hidden] {
  display: none;
}

/* ---------- Footer ---------- */

.guide-footer {
  max-width: var(--guide-max-width);
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 40px) 48px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-faint);
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
}

.guide-footer a {
  color: var(--text-dim);
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .guide-layout {
    grid-template-columns: 1fr;
  }

  .guide-toc {
    position: static;
    max-height: none;
    order: -1;
  }
}
