:root {
  --bg: #080808;
  --bg-soft: #111111;
  --bg-panel: rgba(17, 17, 17, 0.92);
  --bg-card: #141414;
  --bg-elevated: #1a1a1a;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f7f7f7;
  --text-soft: #b0b0b0;
  --text-dim: #6d6d6d;
  --accent: #e11d48;
  --accent-soft: rgba(225, 29, 72, 0.12);
  --accent-strong: rgba(225, 29, 72, 0.22);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.4);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --sidebar-width: 320px;
  --font-body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(225, 29, 72, 0.14), transparent 26%),
    radial-gradient(circle at top right, rgba(225, 29, 72, 0.08), transparent 30%),
    linear-gradient(180deg, #070707 0%, #0a0a0a 50%, #050505 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

img,
svg {
  display: block;
}

code,
pre,
.tree-root-label,
.file-path,
.search-shell span,
.tree-file-meta,
.tree-folder-label span,
.state-kicker,
.doc-meta {
  font-family: var(--font-mono);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.docs-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, var(--sidebar-width)) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 1.3rem 1.1rem 1.5rem;
  border-right: 1px solid var(--border);
  background: var(--bg-panel);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-ring {
  flex: 0 0 auto;
  color: #a855f7;
  filter: drop-shadow(0 0 16px rgba(168, 85, 247, 0.24));
}

.brand-title {
  display: block;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.brand-subtitle {
  display: block;
  margin-top: 0.2rem;
  color: var(--text-dim);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-copy {
  margin: 1rem 0 1.1rem;
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.7;
}

.search-shell {
  display: block;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.search-shell span {
  display: block;
  margin-bottom: 0.55rem;
  color: var(--text-dim);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-shell input {
  width: 100%;
  border: 0;
  outline: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  font-size: 0.92rem;
}

.tree-root-label {
  margin: 1.15rem 0 0.7rem;
  color: var(--text-dim);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tree-nav {
  display: grid;
  gap: 0.3rem;
}

.tree-entry {
  display: grid;
  gap: 0.28rem;
}

.tree-folder {
  display: grid;
  gap: 0.4rem;
}

.tree-folder-label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 34px;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  color: var(--text-soft);
  font-size: 0.84rem;
  font-weight: 600;
}

.tree-folder-label svg {
  flex: 0 0 auto;
  color: #f9b545;
}

.tree-children {
  margin-left: 0.75rem;
  padding-left: 0.85rem;
  border-left: 1px solid rgba(255, 255, 255, 0.07);
  display: grid;
  gap: 0.28rem;
}

.tree-link {
  display: flex;
  align-items: flex-start;
  gap: 0.62rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 12px;
  color: var(--text-soft);
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
  border: 1px solid transparent;
}

.tree-link:hover {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(255, 255, 255, 0.06);
  color: var(--text);
  transform: translateX(2px);
}

.tree-link.is-active {
  background: linear-gradient(180deg, rgba(225, 29, 72, 0.16), rgba(225, 29, 72, 0.08));
  border-color: rgba(225, 29, 72, 0.36);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(225, 29, 72, 0.1);
}

.tree-link svg {
  flex: 0 0 auto;
  margin-top: 0.06rem;
  color: var(--text-dim);
}

.tree-link.is-active svg {
  color: #ff7d99;
}

.tree-file-main {
  display: grid;
  gap: 0.18rem;
}

.tree-file-name {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.35;
}

.tree-file-meta {
  color: var(--text-dim);
  font-size: 0.69rem;
  line-height: 1.4;
}

.tree-empty {
  padding: 0.8rem 0.95rem;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  color: var(--text-dim);
  font-size: 0.82rem;
}

.main-shell {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 8, 8, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.topbar-links {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.topbar-links a,
.mobile-toggle,
.mobile-close {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.topbar-links a:hover,
.mobile-toggle:hover,
.mobile-close:hover {
  color: var(--text);
  border-color: rgba(225, 29, 72, 0.24);
  background: rgba(225, 29, 72, 0.08);
}

.content-shell {
  width: min(960px, calc(100vw - var(--sidebar-width) - 5rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.content-card,
.content-state {
  padding: clamp(1.35rem, 2vw, 2rem);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 26%),
    rgba(10, 10, 10, 0.84);
  box-shadow: var(--shadow);
}

.content-state.is-loading {
  min-height: 280px;
}

.state-kicker,
.doc-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ff8ca5;
}

.content-state h1,
.doc-header h1 {
  margin: 1rem 0 0.8rem;
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.content-state p,
.doc-header p {
  margin: 0;
  max-width: 56ch;
  color: var(--text-soft);
  line-height: 1.8;
}

.doc-header {
  padding-bottom: 1.6rem;
  border-bottom: 1px solid var(--border);
}

.doc-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.doc-header-links {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.doc-header-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.03);
}

.doc-header-links button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.03);
}

.doc-header-links a:hover,
.doc-header-links button:hover {
  color: var(--text);
  border-color: rgba(225, 29, 72, 0.3);
  background: rgba(225, 29, 72, 0.08);
}

.doc-export-note {
  margin-top: 0.9rem;
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(168, 85, 247, 0.28);
  background: rgba(168, 85, 247, 0.08);
  color: #d8b4fe;
  font-size: 0.76rem;
  letter-spacing: 0.02em;
}

.file-path {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.65rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-dim);
  font-size: 0.76rem;
}

.doc-article {
  padding-top: 1.6rem;
  color: var(--text);
}

.doc-article > :first-child {
  margin-top: 0;
}

.doc-article h1,
.doc-article h2,
.doc-article h3,
.doc-article h4 {
  scroll-margin-top: 7rem;
  line-height: 1.14;
  letter-spacing: -0.03em;
}

.doc-article h1 {
  margin: 0 0 1.2rem;
  font-size: clamp(2rem, 4vw, 3rem);
}

.doc-article h2 {
  margin: 2.6rem 0 1rem;
  font-size: clamp(1.45rem, 2.5vw, 2rem);
}

.doc-article h3 {
  margin: 1.8rem 0 0.85rem;
  font-size: 1.15rem;
}

.doc-article p,
.doc-article li,
.doc-article blockquote {
  color: #dddddd;
  font-size: 1rem;
  line-height: 1.85;
}

.doc-article p,
.doc-article ul,
.doc-article ol,
.doc-article table,
.doc-article pre,
.doc-article blockquote {
  margin: 0 0 1.1rem;
}

.doc-article ul,
.doc-article ol {
  padding-left: 1.35rem;
}

.doc-article li + li {
  margin-top: 0.45rem;
}

.doc-article hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.8rem 0;
}

.doc-article a {
  color: #ff8ca5;
  text-decoration: underline;
  text-decoration-color: rgba(255, 140, 165, 0.35);
  text-underline-offset: 0.18em;
}

.doc-article strong {
  color: #ffffff;
}

.doc-article blockquote {
  padding: 1rem 1.1rem;
  border-left: 3px solid rgba(225, 29, 72, 0.5);
  border-radius: 0 14px 14px 0;
  background: rgba(225, 29, 72, 0.08);
}

.doc-article code {
  padding: 0.15rem 0.38rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff1f4;
  font-size: 0.92em;
}

.doc-article pre {
  overflow-x: auto;
  padding: 1rem 1.05rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: #090909;
}

.doc-article pre code {
  padding: 0;
  background: transparent;
  color: #f3f3f3;
  font-size: 0.92rem;
}

.doc-article table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  border-radius: 16px;
  border: 1px solid var(--border);
}

.doc-article table thead {
  background: rgba(255, 255, 255, 0.035);
}

.doc-article th,
.doc-article td {
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  min-width: 170px;
}

.doc-article tr:last-child td {
  border-bottom: 0;
}

.doc-footer-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 2rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
}

.doc-footer-link {
  display: grid;
  gap: 0.22rem;
  min-height: 100%;
  padding: 1rem 1.05rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-soft);
}

.doc-footer-link:hover {
  color: var(--text);
  border-color: rgba(225, 29, 72, 0.28);
  background: rgba(225, 29, 72, 0.07);
}

.doc-footer-link span {
  color: var(--text-dim);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.doc-footer-link strong {
  font-size: 0.95rem;
  line-height: 1.45;
}

.doc-footer-link.is-empty {
  visibility: hidden;
}

.mobile-toggle,
.mobile-close {
  border: 0;
}

.mobile-toggle,
.mobile-close,
.backdrop {
  display: none;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 1080px) {
  .content-shell {
    width: min(900px, calc(100vw - var(--sidebar-width) - 3rem));
  }
}

@media (max-width: 980px) {
  .docs-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(90vw, 360px);
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    z-index: 30;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.56);
    z-index: 20;
  }

  body.nav-open .backdrop {
    display: block;
  }

  .mobile-toggle,
  .mobile-close {
    display: inline-flex;
  }

  .content-shell {
    width: min(920px, calc(100vw - 2rem));
    padding: 1.4rem 0 3rem;
  }
}

@media (max-width: 760px) {
  .topbar {
    padding: 0.9rem 1rem;
  }

  .topbar-links {
    gap: 0.55rem;
  }

  .topbar-links a {
    padding: 0.5rem 0.7rem;
    font-size: 0.86rem;
  }

  .doc-header-top {
    flex-direction: column;
  }

  .doc-header-links {
    justify-content: flex-start;
  }

  .doc-footer-nav {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .content-shell {
    width: calc(100vw - 1rem);
  }

  .content-card,
  .content-state {
    border-radius: 22px;
    padding: 1.15rem;
  }

  .topbar-links a:last-child {
    display: none;
  }
}
