:root {
  --dp-primary: #f59e0b;
  --dp-primary-light: #fbbf24;
  --dp-gradient: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  --dp-bg: rgba(245, 158, 11, 0.06);
}

.typing-text-dp {
  color: var(--dp-primary);
  font-weight: 600;
}

.hero .title-line {
  font-size: 1.2rem;
}

.hero .main-title {
  font-size: 3rem;
}

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

.hero .stat-box {
  padding: 1.25rem 1.5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dp-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  position: relative;
}

.dp-sidebar {
  position: sticky;
  top: 90px;
  width: 220px;
  flex-shrink: 0;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.25rem 0;
  backdrop-filter: blur(10px);
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.dp-sidebar-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  padding: 0 1.25rem 0.75rem;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 0.5rem;
}

.dp-sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.dp-sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease, background 0.2s ease, border-left-color 0.2s ease;
  border-left: 3px solid transparent;
  min-height: 40px;
}

.dp-sidebar-nav li a:hover,
.dp-sidebar-nav li a.active {
  color: var(--dp-primary);
  background: var(--dp-bg);
  border-left-color: var(--dp-primary);
}

.dp-sidebar-nav li a .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.dp-main-content {
  flex: 1;
  min-width: 0;
}

.dp-lesson {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 2.5rem;
  margin-bottom: 2rem;
  backdrop-filter: blur(10px);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  scroll-margin-top: 100px;
}

.dp-lesson:target {
  border-color: var(--dp-primary);
  box-shadow: 0 0 0 1px var(--dp-primary);
}

.dp-lesson-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dp-lesson-number {
  font-family: "Orbitron", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--dp-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
}

.dp-lesson-header h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.dp-lesson p,
.dp-lesson li {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.75;
  margin-bottom: 0.75rem;
}

.dp-lesson ul,
.dp-lesson ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.dp-lesson li {
  margin-bottom: 0.4rem;
}

.dp-lesson strong {
  color: var(--text-primary);
}

.dp-state-box {
  background: var(--dp-bg);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
}

.dp-state-box h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--dp-primary);
  margin: 0 0 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dp-state-row {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
}

.dp-state-label {
  font-weight: 700;
  color: var(--text-primary);
  min-width: 100px;
  flex-shrink: 0;
}

.dp-state-value {
  color: var(--text-secondary);
  font-family: "Fira Code", monospace;
}

.dp-complexity-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.25rem 0;
}

.dp-complexity-box {
  border-radius: 12px;
  padding: 1rem 1.25rem;
  border: 1px solid var(--glass-border);
}

.dp-complexity-box.recursive {
  border-left: 4px solid #ef4444;
  background: rgba(239, 68, 68, 0.04);
}

.dp-complexity-box.memo {
  border-left: 4px solid var(--dp-primary);
  background: var(--dp-bg);
}

.dp-complexity-box.tab {
  border-left: 4px solid #22c55e;
  background: rgba(34, 197, 94, 0.04);
}

.dp-complexity-box h5 {
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0 0 0.4rem;
  color: var(--text-primary);
}

.dp-complexity-box .dp-chip {
  font-family: "Fira Code", monospace;
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 0.2rem;
}

.dp-code-block {
  position: relative;
  margin: 1rem 0 1.5rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
}

.dp-code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--glass-border);
}

.dp-code-lang {
  font-family: "Fira Code", monospace;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--dp-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dp-code-copy {
  background: none;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: "Poppins", sans-serif;
  transition: color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.dp-code-copy:hover {
  color: var(--text-primary);
  border-color: var(--dp-primary);
}

.dp-code-copy.copied {
  color: #22c55e;
  border-color: #22c55e;
}

.dp-code-block pre {
  margin: 0;
  padding: 1.25rem 1.5rem;
  background: #0d1117;
  overflow-x: auto;
}

.dp-code-block code {
  font-family: "Fira Code", Consolas, Monaco, monospace;
  font-size: 0.85rem;
  line-height: 1.7;
  color: #e6edf3;
  white-space: pre;
}

.tok-kw  { color: #c792ea; }
.tok-fn  { color: #82aaff; }
.tok-str { color: #c3e88d; }
.tok-num { color: #f78c6c; }
.tok-cmt { color: #546e7a; font-style: italic; }
.tok-op  { color: #89ddff; }
.tok-bi  { color: #ffcb6b; }
.tok-var { color: #f07178; }
.tok-bool { color: #ff5370; }

.dp-lang-switcher-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.25rem 0.5rem 0;
  border-bottom: 1px solid var(--glass-border);
  gap: 0.25rem;
}

.dp-lang-tab-btn {
  background: none;
  border: 1px solid transparent;
  border-bottom: none;
  color: var(--text-secondary);
  font-family: Poppins, sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.4rem 0.8rem;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: -1px;
}

.dp-lang-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.02);
}

.dp-lang-tab-btn.active {
  color: var(--dp-primary);
  background: #0d1117;
  border-color: var(--glass-border);
}

.dp-lang-pane {
  display: none;
}

.dp-lang-pane.active {
  display: block;
}

.dp-callout {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: var(--dp-bg);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
}

.dp-callout-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  line-height: 1.4;
}

.dp-callout p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.dp-output {
  background: rgba(6, 182, 212, 0.06);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin: 0.75rem 0 1.25rem;
}

.dp-output-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.dp-output pre {
  margin: 0;
  font-family: "Fira Code", monospace;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.dp-progress-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

.dp-progress-track {
  flex: 1;
  height: 8px;
  background: var(--dark-surface);
  border-radius: 99px;
  overflow: hidden;
  min-width: 60px;
}

.dp-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--dp-gradient);
  border-radius: 99px;
  transition: width 0.5s ease;
}

.dp-progress-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.dp-progress-percent {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--dp-primary);
  white-space: nowrap;
  min-width: 2.5rem;
  text-align: right;
}

.dp-exercise {
  background: rgba(34, 197, 94, 0.06);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1.5rem 0;
}

.dp-exercise-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #22c55e;
  margin-bottom: 0.75rem;
}

.dp-exercise-title i {
  font-size: 1.1rem;
}

.dp-exercise-toggle {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #22c55e;
  font-family: "Poppins", sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.dp-exercise-toggle:hover {
  background: rgba(34, 197, 94, 0.25);
}

.dp-exercise-solution {
  display: none;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(34, 197, 94, 0.2);
}

.dp-exercise-solution.visible {
  display: block;
}

.dp-exercise-solution p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

@media (max-width: 1024px) {
  .dp-sidebar {
    display: none;
  }

  .dp-layout {
    display: block;
  }
}

@media (max-width: 768px) {
  .dp-lesson {
    padding: 1.5rem;
  }

  .dp-lesson-header h3 {
    font-size: 1.15rem;
  }

  .dp-code-block pre {
    padding: 1rem;
  }

  .dp-code-block code {
    font-size: 0.78rem;
  }

  .dp-progress-bar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .dp-progress-track {
    flex-basis: 100%;
    order: 2;
  }

  .dp-progress-text {
    order: 1;
  }

  .dp-progress-percent {
    order: 3;
    text-align: left;
  }

  .dp-callout {
    flex-direction: column;
    gap: 0.5rem;
  }

  .dp-complexity-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .dp-lesson {
    padding: 1.25rem;
    border-radius: 12px;
  }

  .dp-lesson-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .dp-exercise {
    padding: 1rem;
  }

  .dp-code-block code {
    font-size: 0.72rem;
  }
}

.dp-sidebar-nav li a:focus-visible,
.dp-code-copy:focus-visible,
.dp-exercise-toggle:focus-visible {
  outline: 2px solid var(--dp-primary);
  outline-offset: 2px;
}

@media print {
  .dp-sidebar,
  .dp-progress-bar,
  .dp-exercise-toggle,
  .dp-code-copy,
  .navbar,
  .footer {
    display: none !important;
  }

  .dp-lesson {
    break-inside: avoid;
    border: 1px solid #ccc;
    box-shadow: none;
  }

  .dp-code-block pre {
    background: #f5f5f5;
    color: #333;
  }

  .dp-code-block code {
    color: #333;
  }
}
