:root {
  color-scheme: light;
  
  /* Modern retro paper palette - Light Mode */
  --bg: #faf7f2;
  --bg2: #fff;
  --fg: #2c2416;
  --muted: #6b5d4f;
  --border: rgba(44, 36, 22, 0.12);
  --panel: rgba(255, 250, 245, 0.95);
  --link: #d97706;
  --accent: #dc2626;
  --accent2: #16a34a;
  --code-bg: #fef3c7;
  --progress-bg: rgba(217, 119, 6, 0.1);
  
  --radius: 10px;
  --pad: 20px;
  --max: 900px;
  --shadow: 0 10px 30px rgba(44, 36, 22, 0.08);
  --shadow-lg: 0 20px 50px rgba(44, 36, 22, 0.12);
  
  /* Font size control */
  --font-size: 16px;
}

/* Dark Mode Theme */
[data-theme="dark"] {
  color-scheme: dark;
  
  --bg: #0f0f0f;
  --bg2: #1a1a1a;
  --fg: #e5e5e5;
  --muted: #a1a1a1;
  --border: rgba(255, 255, 255, 0.08);
  --panel: rgba(26, 26, 26, 0.98);
  --link: #fbbf24;
  --accent: #fb923c;
  --accent2: #4ade80;
  --code-bg: #1e1e1e;
  --progress-bg: rgba(251, 191, 36, 0.12);
  
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] body {
  background: var(--bg);
}

[data-theme="dark"] ::selection {
  background: rgba(251, 191, 36, 0.25);
  color: var(--fg);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  background-attachment: fixed;
  color: var(--fg);
  line-height: 1.7;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--font-size);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s ease, color 0.3s ease;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: all 0.2s ease;
}

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

::selection {
  background: rgba(217, 119, 6, 0.2);
  color: var(--fg);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

code, pre {
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
}

/* Progress Bar */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--link));
  width: 0%;
  z-index: 1000;
  transition: width 0.15s ease-out;
}

/* App Container */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Top Bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px var(--pad);
  background: var(--panel);
  backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.menu-toggle:hover {
  background: var(--progress-bg);
  border-color: var(--link);
}

.menu-toggle:active {
  transform: scale(0.96);
}

.menu-toggle__bar {
  width: 100%;
  height: 2px;
  background: var(--fg);
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  transition: all 0.2s ease;
}

.brand__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand__title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
  line-height: 1.2;
}

.brand__title:hover {
  color: var(--accent);
}

.brand__subtitle {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
  line-height: 1;
}

.topbar__right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.control-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  cursor: pointer;
  transition: all 0.2s ease;
}

.control-btn:hover {
  background: var(--link);
  color: var(--bg2);
  border-color: var(--link);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--progress-bg);
}

.control-btn:active {
  transform: translateY(0);
}

.theme-icon {
  transition: all 0.2s ease;
}

.theme-icon--moon {
  display: none;
}

[data-theme="dark"] .theme-icon--sun {
  display: none;
}

[data-theme="dark"] .theme-icon--moon {
  display: block;
}

.search-container {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 240px;
  padding: 8px 12px 8px 36px;
  font-size: 0.875rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.2s ease;
  outline: none;
}

.search-input::placeholder {
  color: var(--muted);
}

.search-input:focus {
  background: var(--bg2);
  border-color: var(--link);
  box-shadow: 0 0 0 3px var(--progress-bg);
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--muted);
  pointer-events: none;
}

/* Layout */
.layout {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  flex: 1;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 16px;
  background: var(--panel);
  backdrop-filter: blur(10px) saturate(120%);
  border-right: 1px solid var(--border);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar::-webkit-scrollbar {
  width: 5px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
  transition: background 0.2s ease;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--link);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
}

.sidebar__header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar__title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 12px;
}

.reading-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--progress-bg);
  border-radius: 6px;
  font-size: 0.8125rem;
}

.stat-icon {
  font-size: 1rem;
  line-height: 1;
}

.stat-text {
  color: var(--fg);
  font-weight: 500;
}

.overall-progress {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.progress-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--fg);
}

.progress-percentage {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--link);
}

.progress-track {
  height: 8px;
  background: var(--border);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--link), var(--accent));
  border-radius: 10px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px var(--progress-bg);
}
}

/* TOC */
.toc {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toc-group {
  margin-bottom: 12px;
}

.toc-group__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
  transition: all 0.2s ease;
  user-select: none;
  position: relative;
}

.toc-group__header:hover {
  background: var(--progress-bg);
  border-color: var(--link);
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.1);
}

.toc-group__header.completed::before {
  content: '✓';
  position: absolute;
  right: 40px;
  color: var(--accent2);
  font-weight: bold;
  font-size: 1rem;
}

.chapter-progress {
  padding: 0 12px 8px 12px;
  margin-top: 10px;
}

.chapter-progress .progress-header {
  margin-bottom: 8px;
}

.chapter-progress .progress-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.chapter-progress .progress-percentage {
  font-size: 0.75rem;
  font-weight: 600;
}

.chapter-progress .progress-track {
  height: 6px;
}

.toc-group__toggle {
  font-size: 0.875rem;
  transition: transform 0.25s ease;
  color: var(--muted);
}

.toc-group__header[aria-expanded="true"] .toc-group__toggle {
  transform: rotate(180deg);
}

.toc-group__content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
  opacity: 0;
  padding-left: 8px;
}

.toc-group__content.expanded {
  max-height: 2000px;
  opacity: 1;
  margin-top: 6px;
}

.toc a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 0.875rem;
  color: var(--fg);
  border-radius: 6px;
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
  position: relative;
}

.topic-checkbox {
  width: 16px;
  height: 16px;
  min-width: 16px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--bg2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
}

.topic-checkbox:hover {
  border-color: var(--link);
  background: var(--progress-bg);
}

.topic-checkbox.checked {
  background: var(--accent2);
  border-color: var(--accent2);
}

.topic-checkbox.checked::after {
  content: '✓';
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
  line-height: 1;
}

.topic-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toc a:hover {
  background: var(--progress-bg);
  border-left-color: var(--link);
  padding-left: 16px;
  color: var(--link);
}

.toc a[aria-current="true"] {
  background: var(--progress-bg);
  border-left-color: var(--link);
  color: var(--link);
  font-weight: 600;
}

.toc a.bookmarked::after {
  content: '⭐';
  font-size: 0.75rem;
  animation: bookmark-pulse 0.3s ease;
}

@keyframes bookmark-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

.toc a.completed {
  opacity: 0.7;
}

.toc a.completed .topic-text {
  text-decoration: line-through;
  text-decoration-color: var(--muted);
}
}

.toc a:hover {
  background: rgba(217, 119, 6, 0.06);
  border-left-color: var(--link);
  transform: translateX(2px);
  color: var(--link);
}

.toc a[aria-current="true"] {
  background: rgba(220, 38, 38, 0.08);
  border-left-color: var(--accent);
  font-weight: 600;
  color: var(--accent);
}

.toc .lvl-1 { padding-left: 12px; }
.toc .lvl-2 { padding-left: 24px; font-size: 0.8125rem; }
.toc .lvl-3 { padding-left: 36px; font-size: 0.8125rem; }

/* Main Content */
.main {
  padding: var(--pad);
  min-width: 0;
}

.status {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 16px;
  font-style: italic;
}

/* Hero Video Section */
.hero-video-section {
  max-width: var(--max);
  margin: 0 auto 32px;
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 48px;
  box-shadow: var(--shadow);
  text-align: center;
}

.hero-video-content {
  width: 100%;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 12px;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--muted);
  margin-bottom: 32px;
  line-height: 1.6;
}

.hero-video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  margin-bottom: 32px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 2px solid var(--border);
  background: #000;
}

.hero-video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-btn {
  display: inline-block;
  padding: 14px 32px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  transition: all 0.3s ease;
  text-decoration: none;
  cursor: pointer;
}

.hero-btn-primary {
  background: var(--link);
  color: #fff;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

.hero-btn-primary:hover {
  background: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.4);
  color: #fff;
}

.hero-btn-secondary {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  border: none;
  position: relative;
  overflow: hidden;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  animation: pulse-glow 2s ease-in-out infinite;
}

.hero-btn-secondary::before {
  content: "📚";
  margin-right: 8px;
  font-size: 1.1em;
}

.hero-btn-secondary::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.hero-btn-secondary:hover::after {
  width: 300px;
  height: 300px;
}

.hero-btn-secondary:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
  color: #fff;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  }
  50% {
    box-shadow: 0 4px 25px rgba(99, 102, 241, 0.6), 0 0 30px rgba(99, 102, 241, 0.3);
  }
}

[data-theme="dark"] .hero-btn-secondary {
  background: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
  box-shadow: 0 4px 15px rgba(129, 140, 248, 0.4);
}

[data-theme="dark"] .hero-btn-secondary:hover {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  box-shadow: 0 8px 25px rgba(129, 140, 248, 0.5);
  color: #fff;
}

@media (max-width: 768px) {
  .hero-video-section {
    padding: 32px 24px;
    margin-bottom: 24px;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .hero-cta {
    flex-direction: column;
  }

  .hero-btn {
    width: 100%;
    text-align: center;
  }
}

.content {
  max-width: var(--max);
  margin: 0 auto;
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 48px;
  box-shadow: var(--shadow);
  transition: background 0.3s ease;
}

.content h1, .content h2, .content h3, .content h4, .content h5, .content h6 {
  scroll-margin-top: 80px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  transition: color 0.3s ease;
}

.content h1 {
  font-size: 2.5rem;
  margin: 48px 0 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

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

.content h2 {
  font-size: 1.875rem;
  margin: 40px 0 20px;
}

.content h3 {
  font-size: 1.5rem;
  margin: 32px 0 16px;
}

.content h4 {
  font-size: 1.25rem;
  margin: 24px 0 12px;
}

.content p {
  margin: 16px 0;
  color: var(--fg);
}

.content strong {
  font-weight: 600;
  color: var(--fg);
}

.content em {
  font-style: italic;
}

.content ul, .content ol {
  margin: 16px 0;
  padding-left: 28px;
}

.content li {
  margin: 8px 0;
}

.content a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: rgba(217, 119, 6, 0.3);
  text-underline-offset: 2px;
  transition: all 0.2s ease;
}

.content a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.content img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 32px auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  object-fit: cover;
}

.content a {
  text-decoration: none;
}

.content a img {
  width: 100%;
  max-width: 100%;
  margin: 0;
}

.content p {
  margin: 16px 0;
}

.content p:has(> a > img) {
  margin: 32px 0;
  width: 100%;
}

.content p > a:has(img) {
  display: block;
  width: 100%;
  line-height: 0;
}

.content pre {
  position: relative;
  overflow-x: auto;
  padding: 20px;
  margin: 24px 0;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  line-height: 1.6;
  box-shadow: var(--shadow);
}

.content pre .copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 6px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.content pre:hover .copy-btn {
  opacity: 1;
}

.content pre .copy-btn:hover {
  background: var(--link);
  color: var(--bg2);
  border-color: var(--link);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px var(--progress-bg);
}

.content pre .copy-btn.copied {
  background: var(--accent2);
  color: var(--bg2);
  border-color: var(--accent2);
}

.content pre::-webkit-scrollbar {
  height: 8px;
}

.content pre::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 4px;
}

.content pre::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
  transition: background 0.2s ease;
}

.content pre::-webkit-scrollbar-thumb:hover {
  background: var(--link);
}

.content pre[data-lang] {
  padding-top: 40px;
}

.content pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 10px;
  left: 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 4px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.content :not(pre) > code {
  padding: 2px 6px;
  font-size: 0.875em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--fg);
}

.table-wrap {
  overflow-x: auto;
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--progress-bg);
  font-weight: 600;
  color: var(--fg);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--progress-bg);
}

hr {
  margin: 40px 0;
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

/* Footer */
.footer {
  padding: 32px var(--pad);
  text-align: center;
  background: var(--bg);
  border-top: 1px solid var(--border);
  transition: all 0.3s ease;
}

.footer__content {
  max-width: 600px;
  margin: 0 auto;
}

.footer__text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 6px;
}

.footer__meta {
  font-size: 0.8125rem;
  color: var(--muted);
}

.footer code {
  padding: 2px 6px;
  background: var(--code-bg);
  border-radius: 4px;
  font-size: 0.875em;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 50%;
  box-shadow: var(--shadow-lg);
  color: var(--link);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 50;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--link);
  color: var(--bg2);
  border-color: var(--link);
  transform: translateY(-4px);
  box-shadow: 0 12px 32px var(--progress-bg);
}

.back-to-top:active {
  transform: translateY(-2px);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 260px 1fr;
  }
  
  .content {
    padding: 36px 32px;
  }
}

@media (max-width: 900px) {
  .menu-toggle {
    display: flex;
  }

  .brand__subtitle {
    display: none;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    height: 100vh;
    z-index: 95;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    background: var(--panel);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .sidebar-overlay.active {
    display: block;
  }

  .content {
    padding: 32px 24px;
  }

  .content h1 {
    font-size: 2rem;
  }

  .content h2 {
    font-size: 1.5rem;
  }

  .brand__subtitle {
    display: none;
  }
}

@media (max-width: 640px) {
  :root {
    --pad: 16px;
  }

  .topbar {
    padding: 10px var(--pad);
  }

  .brand__title {
    font-size: 1rem;
  }

  .search-container {
    display: none;
  }

  .sidebar {
    width: 100%;
    max-width: 100vw;
  }

  .content {
    padding: 20px 16px;
    border-radius: 0;
  }

  .content h1 {
    font-size: 1.75rem;
    margin: 28px 0 16px;
  }

  .content h2 {
    font-size: 1.375rem;
  }

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

  .content table {
    font-size: 0.8125rem;
  }

  .content pre {
    font-size: 0.8125rem;
    padding: 12px;
  }

  .footer__text {
    font-size: 0.8125rem;
  }

  .footer__meta {
    font-size: 0.75rem;
  }

  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
  }
}

@media (min-width: 1200px) {
  .layout {
    grid-template-columns: 320px 1fr;
  }

  .sidebar {
    padding: 28px 20px;
  }

  .content {
    padding: 48px 56px;
  }
}
