:root {
  --bg: #08111c;
  --panel: rgba(7, 15, 25, 0.76);
  --text: #f5f7fb;
  --muted: #d5ddec;
  --accent: #89d6ff;
  --accent-warm: #ffd38a;
  --border: rgba(255, 255, 255, 0.16);
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
  --max: 980px;
  --page-background-image: url("/assets/images/background/wallpaper.jpg");
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(135deg, rgba(4, 9, 15, 0.78), rgba(8, 18, 28, 0.6)),
    radial-gradient(circle at top left, rgba(77, 176, 255, 0.16), transparent 34%),
    radial-gradient(circle at bottom right, rgba(255, 211, 138, 0.14), transparent 26%),
    var(--page-background-image);
  background-position: center, center, center, center;
  background-size: auto, auto, auto, cover;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 17, 28, 0.16), rgba(8, 17, 28, 0.84));
  z-index: -1;
}

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

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

video,
audio {
  max-width: 100%;
  display: block;
}

code,
pre {
  font-family: "JetBrains Mono", Consolas, monospace;
}

.shell {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(18px);
  background: rgba(5, 12, 20, 0.55);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.26s ease, opacity 0.26s ease;
}

.nav.is-hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
}

.brand {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.btn-primary {
  background: linear-gradient(135deg, rgba(77, 176, 255, 0.96), rgba(255, 211, 138, 0.84));
  color: #09111a;
  font-weight: 800;
  border: none;
}

.hero {
  padding: 48px 0 22px;
}

.panel {
  padding: 28px;
  border-radius: 28px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.tag {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(137, 214, 255, 0.14);
  border: 1px solid rgba(137, 214, 255, 0.28);
  color: #d8f0ff;
  font-size: 0.92rem;
}

.title {
  margin: 14px 0 10px;
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.description {
  margin: 0;
  color: var(--muted);
  max-width: 62ch;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.status {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #e4edf8;
}

.status.is-error {
  background: rgba(255, 120, 120, 0.12);
  border-color: rgba(255, 120, 120, 0.28);
  color: #ffd8d8;
}

.status.is-hidden {
  display: none;
}

.content-wrap {
  padding-bottom: 56px;
  overflow: visible;
}

.post-layout {
  position: relative;
}

.content {
  padding: 24px;
  border-radius: 28px;
  background: rgba(7, 15, 25, 0.76);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.content h1,
.content h2,
.content h3,
.content h4,
.content h5,
.content h6 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  line-height: 1.18;
  letter-spacing: -0.03em;
}

.content h1:first-child,
.content h2:first-child,
.content h3:first-child {
  margin-top: 0;
}

.content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(137, 214, 255, 0.4);
  text-underline-offset: 3px;
  word-break: break-word;
}

.content p,
.content li,
.content blockquote {
  color: #eef4fb;
}

.content pre {
  padding: 16px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.34);
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.content code {
  padding: 0.15em 0.35em;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.92em;
}

.content pre code {
  padding: 0;
  background: transparent;
}

.content blockquote {
  margin: 1.25rem 0;
  padding: 0.7rem 1rem;
  border-left: 3px solid rgba(137, 214, 255, 0.75);
  background: rgba(137, 214, 255, 0.08);
  border-radius: 0 14px 14px 0;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
}

.content th,
.content td {
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
}

.content th {
  background: rgba(255, 255, 255, 0.08);
}

.toc-shell {
  position: fixed;
  top: 86px;
  left: 0;
  width: 290px;
  z-index: 20;
}

.post-music-shell {
  position: fixed;
  top: 86px;
  left: 22px;
  width: min(360px, calc(100vw - 32px));
  z-index: 22;
}

.post-music-card {
  padding: 18px;
  border-radius: 24px;
  background: rgba(7, 15, 25, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  display: grid;
  gap: 12px;
}

.post-music-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.post-music-eyebrow {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(137, 214, 255, 0.78);
}

.post-music-title {
  margin: 6px 0 0;
  font-size: 1.05rem;
  line-height: 1.15;
}

.post-music-subtitle {
  margin: 6px 0 0;
  color: rgba(213, 221, 236, 0.82);
  font-size: 0.88rem;
}

.post-music-progress {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.post-music-progress-bar {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(137, 214, 255, 0.95), rgba(255, 211, 138, 0.9));
  transition: width 0.18s linear;
}

.post-music-meta {
  color: rgba(245, 247, 251, 0.72);
  font-size: 0.82rem;
}

.post-music-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.post-music-btn,
.post-music-toggle {
  min-height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #eef8ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.post-music-toggle {
  min-width: 40px;
  min-height: 40px;
}

.post-music-btn:hover:not(:disabled),
.post-music-toggle:hover:not(:disabled) {
  transform: translateY(-1px);
  background: rgba(137, 214, 255, 0.12);
  border-color: rgba(137, 214, 255, 0.24);
}

.post-music-btn:disabled,
.post-music-toggle:disabled {
  opacity: 0.45;
  cursor: default;
}

.post-music-btn.is-active {
  background: rgba(137, 214, 255, 0.16);
  border-color: rgba(137, 214, 255, 0.34);
  color: #dff4ff;
}

.post-music-btn svg,
.post-music-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.post-music-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.post-music-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.post-music-playlist {
  display: grid;
  gap: 8px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.28s ease;
}

.post-music-card.is-expanded .post-music-playlist {
  max-height: 260px;
}

.post-music-playlist-inner {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(137, 214, 255, 0.3) rgba(255, 255, 255, 0.02);
}

.post-music-track {
  width: 100%;
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.post-music-track:hover {
  transform: translateX(2px);
  background: rgba(137, 214, 255, 0.08);
  border-color: rgba(137, 214, 255, 0.18);
}

.post-music-track.is-active {
  background: rgba(137, 214, 255, 0.14);
  border-color: rgba(137, 214, 255, 0.28);
}

.post-music-track-title,
.post-music-track-subtitle {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-music-track-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #dff4ff;
}

.post-music-track-subtitle {
  color: rgba(213, 221, 236, 0.74);
  font-size: 0.78rem;
}

.toc-card {
  padding: 18px 18px 20px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 32%),
    rgba(7, 15, 25, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.toc-eyebrow {
  width: 100%;
  padding: 0;
  margin: 0 0 12px;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  font-family: inherit;
  text-align: left;
  text-transform: uppercase;
  color: rgba(137, 214, 255, 0.72);
  cursor: pointer;
  user-select: none;
}

.toc-eyebrow-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.toc-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(213, 221, 236, 0.62);
  transition: transform 0.2s ease, color 0.2s ease;
}

.toc-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toc-title {
  margin: 0 0 14px;
  font-size: 1rem;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(245, 247, 251, 0.92);
}

.toc-card.is-collapsed .toc-title,
.toc-card.is-collapsed .toc-nav {
  display: none;
}

.toc-card.is-collapsed .toc-icon {
  transform: rotate(-90deg);
}

.toc-nav {
  display: block;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(137, 214, 255, 0.3) rgba(255, 255, 255, 0.02);
}

.toc-nav::-webkit-scrollbar {
  width: 6px;
}
.toc-nav::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
}
.toc-nav::-webkit-scrollbar-thumb {
  background: rgba(137, 214, 255, 0.3);
  border-radius: 4px;
}
.toc-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(137, 214, 255, 0.5);
}

.toc-empty {
  margin: 0;
  color: rgba(213, 221, 236, 0.72);
  font-size: 0.92rem;
}

.toc-list,
.toc-child {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc-child {
  margin-top: 6px;
  margin-left: 20px;
}

.toc-item {
  position: relative;
  margin: 8px 0;
  padding-left: 18px;
  list-style: none;
}

.toc-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 5px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 211, 138, 0.52);
  box-shadow: 0 0 12px rgba(255, 211, 138, 0.16);
  opacity: 0.6;
  transition: transform 0.22s ease, border-radius 0.22s ease, opacity 0.22s ease, background 0.22s ease, height 0.22s ease;
}

.toc-item:hover::before,
.toc-item.is-current::before {
  height: 6px;
  border-radius: 50%;
  transform: translateY(1px);
  opacity: 1;
  background: rgba(137, 214, 255, 0.88);
}

.toc-link {
  display: block;
  color: rgba(213, 221, 236, 0.76);
  line-height: 1.45;
  opacity: 0.84;
  transition: color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
  overflow-wrap: break-word;
  word-break: break-word;
}

.toc-text {
  display: inline;
}

.toc-link:hover {
  transform: translateX(2px);
  color: #ffffff;
  opacity: 1;
}

.toc-level-1 > .toc-link {
  font-weight: 700;
  color: rgba(245, 247, 251, 0.9);
}

.toc-level-2 > .toc-link,
.toc-level-3 > .toc-link {
  font-size: 0.92rem;
}

.toc-item.is-current > .toc-link,
.toc-link.is-active {
  color: #ffffff;
  opacity: 1;
}

.toc-item.is-current > .toc-link .toc-text {
  text-shadow: 0 0 18px rgba(137, 214, 255, 0.12);
}

.content [id] {
  scroll-margin-top: 88px;
}

.footer {
  padding: 0 0 48px;
  text-align: center;
  color: rgba(245, 247, 251, 0.8);
}

@media (max-width: 1320px) {
  .toc-shell {
    position: static;
    width: auto;
    margin-top: 18px;
  }

  .toc-card {
    position: static;
  }

  .post-music-shell {
    position: static;
    width: auto;
    margin-top: 18px;
  }
}

@media (max-width: 720px) {
  .nav-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel,
  .content {
    padding: 18px;
  }

  .post-music-card {
    padding: 16px;
  }
}
