:root {
  --primary: #5b5ceb;
  --primary-rgb: 91, 92, 235;
  --accent: #ec4899;
  --accent-rgb: 236, 72, 153;
  --gradient: linear-gradient(90deg, var(--primary), var(--accent));
  
  /* Light Theme Defaults */
  --bg-gradient: radial-gradient(circle at top left, #f5ecff, #fafbff 45%, #eef8ff);
  --bg-color: #fafbff;
  --text-main: #111827;
  --text-muted: #667085;
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-border: 1px solid rgba(91, 92, 235, 0.08);
  --card-shadow: 0 10px 25px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.02);
  --aside-bg: rgba(255, 255, 255, 0.85);
  --pre-bg: #0f172a;
  --placeholder-bg: #faf7ff;
  --placeholder-border: 2px dashed #c7c7ff;
  --badge-bg: #ffffff;
  --badge-border: #eeeeee;
  --step-circle-bg: linear-gradient(135deg, #5b5ceb, #ec4899);
  --step-circle-text: #ffffff;
  --timeline-line: #8b5cf6;
  --link-color: #555555;
  --link-active: #5b5ceb;
  --scrollbar-thumb: #c7c7ff;
  --code-copy-bg: rgba(255, 255, 255, 0.1);
  --code-copy-hover: rgba(255, 255, 255, 0.2);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark Theme Styles */
    --bg-gradient: radial-gradient(circle at top left, #0f0d1a, #090a10 45%, #050814);
    --bg-color: #090a10;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --card-bg: rgba(17, 24, 39, 0.75);
    --card-border: 1px solid rgba(255, 255, 255, 0.06);
    --card-shadow: 0 10px 25px rgba(0, 0, 0, 0.4), 0 0 1px rgba(255, 255, 255, 0.1);
    --aside-bg: rgba(17, 24, 39, 0.8);
    --pre-bg: #030712;
    --placeholder-bg: #111324;
    --placeholder-border: 2px dashed #3b3a6d;
    --badge-bg: rgba(255, 255, 255, 0.05);
    --badge-border: rgba(255, 255, 255, 0.1);
    --step-circle-bg: linear-gradient(135deg, #7c3aed, #db2777);
    --step-circle-text: #ffffff;
    --timeline-line: #7c3aed;
    --link-color: #9ca3af;
    --link-active: #a5b4fc;
    --scrollbar-thumb: #3b3a6d;
    --code-copy-bg: rgba(255, 255, 255, 0.05);
    --code-copy-hover: rgba(255, 255, 255, 0.15);
  }
}

/* Reset and Layout */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

body {
  background: var(--bg-gradient);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 4px;
}

/* Header */
header {
  text-align: center;
  padding: 90px 20px 50px;
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 200px;
  background: radial-gradient(circle, rgba(var(--primary-rgb), 0.15) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

.badge {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--badge-bg);
  border: 1px solid var(--badge-border);
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(8px);
}

h1 {
  font-size: 58px;
  font-weight: 800;
  margin: 22px 0;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.grad {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  display: inline-block;
}

.sub {
  max-width: 850px;
  margin: auto;
  font-size: 20px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.7;
}

/* Page Container */
.container {
  max-width: 1000px;
  margin: auto;
  padding: 20px;
}

/* Navigation Bar */
.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  border: var(--card-border);
  padding: 14px 24px;
  border-radius: 16px;
  margin-bottom: 24px;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(16px);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(var(--primary-rgb), 0.06);
  color: var(--primary);
  border: 1px solid rgba(var(--primary-rgb), 0.12);
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.2);
}

.nav-group {
  display: flex;
  gap: 12px;
}

/* Cards & Sections */
.card {
  background: var(--card-bg);
  border: var(--card-border);
  padding: 32px;
  border-radius: 22px;
  box-shadow: var(--card-shadow);
  margin-bottom: 32px;
  backdrop-filter: blur(16px);
}

.card h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Timeline */
.timeline {
  border-left: 4px solid var(--timeline-line);
  padding-left: 36px;
  margin-left: 16px;
  position: relative;
}

.step {
  position: relative;
  margin-bottom: 48px;
}

.step:last-child {
  margin-bottom: 16px;
}

.step::before {
  content: attr(data-step);
  position: absolute;
  left: -56px;
  top: -2px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--step-circle-bg);
  color: var(--step-circle-text);
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 4px 10px rgba(var(--primary-rgb), 0.3);
  z-index: 1;
}

.step h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-main);
}

.step p {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 16px;
}

.step b {
  color: var(--primary);
  font-weight: 600;
}

/* Placeholders & Generated Images */
.placeholder {
  margin-top: 16px;
  border: var(--placeholder-border);
  border-radius: 16px;
  background: var(--placeholder-bg);
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-align: center;
  padding: 24px;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.03);
}

.image-container {
  margin-top: 16px;
  border: var(--placeholder-border);
  border-radius: 16px;
  background: var(--placeholder-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.03);
}

.placeholder-img {
  width: 100%;
  max-height: 750px;
  object-fit: contain;
  border-radius: 8px;
  transition: transform 0.3s ease;
}

.image-container:hover .placeholder-img {
  transform: scale(1.01);
}

/* Code Blocks */
.code-wrapper {
  position: relative;
  margin: 16px 0;
}

pre {
  background: var(--pre-bg);
  color: #f8fafc;
  padding: 20px 24px;
  border-radius: 14px;
  overflow-x: auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  line-height: 1.6;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

pre code {
  font-family: 'Fira Code', 'Courier New', Courier, monospace;
}

.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--code-copy-bg);
  border: none;
  color: #cbd5e1;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  font-weight: 500;
}

.copy-btn:hover {
  background: var(--code-copy-hover);
  color: #ffffff;
}

.copy-btn.copied {
  background: #10b981;
  color: #ffffff;
}

/* Lists */
ul {
  padding-left: 24px;
}

ul li {
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.7;
}

ul li::marker {
  color: var(--primary);
}

/* Footer */
footer {
  text-align: center;
  padding: 60px 20px 40px;
  color: var(--text-muted);
  font-size: 14px;
  border-top: 1px solid rgba(var(--primary-rgb), 0.05);
  margin-top: 60px;
}

/* Responsive Styles */
@media (max-width: 960px) {
  .nav-bar {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
    text-align: center;
  }
  .nav-group {
    justify-content: center;
  }

  h1 {
    font-size: 42px;
  }
}
