#search-panel {
  display: block !important;
  position: absolute !important;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) !important;
  overflow-y: auto;
  max-height: 85vh;
  padding: 30px 40px;
}

#search-panel .questionnaire-input {
  margin-bottom: 30px;
}

.topics-grid {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}

.topic-card {
  background: rgba(12,16,28,0.25);
  backdrop-filter: blur(5px);
  border: 1px solid rgba(120,160,255,0.35) !important;
  border-left: 4px solid rgba(60, 90, 160, 0.8) !important;
  border-radius: 12px;
  padding: 20px 24px;
  transition: all 0.3s ease;
  cursor: pointer;
  box-shadow: 0 0 15px rgba(0,80,255,0.1), inset 0 0 12px rgba(45,60,120,0.12);
}

.topic-card:hover {
  transform: translateY(-3px);
  border-color: rgba(120, 160, 255, 0.35);
  border-left-color: rgba(90, 120, 200, 1);
  box-shadow: 0 0 20px rgba(50, 90, 255, 0.25), inset 0 0 15px rgba(45,60,120,0.18);
  background: rgba(16,20,32,0.35);
}

.topic-card-title {
  margin: 0 0 10px;
  font-family: 'Space', sans-serif;
  font-size: 20px;
  color: #cfe8ff;
  letter-spacing: 1px;
}

.topic-card-desc {
  margin: 0 0 12px;
  font-size: 15px;
  color: #9bb0c1;
  line-height: 1.4;
}

.topic-card-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.category-badge {
  display: inline-block;
  background: rgba(60, 90, 255, 0.35);
  color: #cfe8ff;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(120, 160, 255, 0.3);
}

.tag-badge {
  display: inline-block;
  background: rgba(40, 60, 100, 0.4);
  color: #9bb0c1;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
}

#topic-panel {
  display: none;
  position: absolute !important;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) !important;
  padding: 30px 40px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  max-height: 85vh !important;
  background: rgba(14, 18, 28, 0.68) !important;
  backdrop-filter: blur(18px) !important;
  border: 1px solid rgba(120,160,255,0.35) !important;
  box-shadow: 0 0 30px rgba(0, 80, 255, 0.25), inset 0 0 25px rgba(45, 60, 120, 0.25) !important;
}

#topic-panel.active {
  display: block !important;
}

#topicContainer {
  width: 100%;
  padding: 0;
  margin: 0;
}

.topic-content-wrapper {
  padding: 0;
  margin: 0;
}

#topic-panel::-webkit-scrollbar,
#search-panel::-webkit-scrollbar {
  width: 10px;
}

#topic-panel::-webkit-scrollbar-track,
#search-panel::-webkit-scrollbar-track {
  background: rgba(20, 30, 50, 0.3);
  border-radius: 10px;
}

#topic-panel::-webkit-scrollbar-thumb,
#search-panel::-webkit-scrollbar-thumb {
  background: rgba(90, 140, 255, 0.4);
  border-radius: 10px;
  border: 2px solid rgba(20, 30, 50, 0.3);
  box-shadow: 0 0 6px rgba(90, 140, 255, 0.3);
}

#topic-panel::-webkit-scrollbar-thumb:hover,
#search-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(120, 160, 255, 0.6);
  box-shadow: 0 0 10px rgba(120, 160, 255, 0.5);
}

#topic-panel,
#search-panel {
  scrollbar-width: thin;
  scrollbar-color: rgba(90, 140, 255, 0.4) rgba(20, 30, 50, 0.3);
}

.topic-content-wrapper {
  width: 100%;
  padding-top: 10px;
}

.topic-sections {
  margin-top: 20px;
}

.topic-section {
  background: rgba(12,16,28,0.25);
  backdrop-filter: blur(5px);
  border: 1px solid rgba(120,160,255,0.35) !important;
  border-left: 4px solid rgba(60, 90, 160, 0.8) !important;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: 0 0 15px rgba(0,80,255,0.1), inset 0 0 12px rgba(45,60,120,0.12);
}

.topic-section-heading {
  font-family: 'Space', sans-serif;
  font-size: 22px;
  color: #7c8cff;
  margin: 0 0 15px;
  letter-spacing: 1px;
}

.topic-section-text {
  font-size: 16px;
  line-height: 1.6;
  color: #d4deff;
  margin-bottom: 12px;
}

.topic-list {
  margin: 0;
  padding-left: 25px;
  color: #d4deff;
}

.topic-list li {
  margin-bottom: 8px;
  line-height: 1.5;
}

.topic-ordered {
  padding-left: 30px;
}

.topic-warning {
  border-left-color: rgba(255, 150, 80, 0.8);
  background: rgba(20, 18, 16, 0.45);
}

.topic-warning .topic-section-heading {
  color: #ffaa77;
}

.topic-takeaways {
  border-left-color: rgba(80, 220, 140, 0.8);
  background: rgba(20, 35, 30, 0.5);
}

.topic-takeaways .topic-section-heading {
  color: #77ddaa;
}

.topic-glossary-terms {
  margin: 0;
}

.topic-glossary-terms dt {
  font-weight: 600;
  color: #cfe8ff;
  margin-top: 12px;
}

.topic-glossary-terms dd {
  margin-left: 20px;
  color: #a8b8d8;
  margin-bottom: 8px;
}

.topic-ascii {
  background: rgba(10, 15, 25, 0.6);
  border: 1px solid rgba(120, 160, 255, 0.2);
  border-radius: 6px;
  padding: 15px;
  color: #9bb0ff;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  overflow-x: auto;
  line-height: 1.4;
}

/* Header */
.main-header {
  text-align: center;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--border);
}

.main-header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.tagline {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Search Box */
.search-box {
  margin-bottom: 2rem;
}

#searchInput {
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  transition: all 0.2s;
}

#searchInput:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Topics Grid*/
.topics-grid {
  display: grid;
  gap: 1.5rem;
}

.topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.2s;
  cursor: pointer;
}

.topic-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.topic-title {
  margin-bottom: 0.75rem;
}

.topic-title a {
  color: var(--text);
  text-decoration: none;
  font-size: 1.5rem;
}

.topic-title a:hover {
  color: var(--primary);
}

.topic-description {
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.topic-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.topic-category {
  background: var(--primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
}

.topic-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  background: var(--code-bg);
  padding: 0.25rem 0.625rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* TopicPage */
.topic-page {
  background: var(--surface);
  border-radius: 12px;
  padding: 2rem;
}

.topic-header {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--border);
}

.topic-header h1 {
  font-size: 2.25rem;
  margin-bottom: 0.75rem;
  color: var(--primary);
}

.subtitle {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.back-link {
  display: inline-block;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  margin-top: 1rem;
}

.back-link:hover {
  text-decoration: underline;
}

/* Sections */
.section {
  margin-bottom: 2.5rem;
}

.section h2 {
  font-size: 1.75rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.section p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

.lead {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--primary-dark);
}

/* Lists */
.section ul, .section ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.section li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.analogy-list li {
  background: var(--code-bg);
  padding: 0.75rem 1rem;
  margin-bottom: 0.625rem;
  border-radius: 6px;
  list-style: none;
  margin-left: 0;
}

.steps-list {
  counter-reset: step-counter;
  list-style: none;
  margin-left: 0;
}

.steps-list li {
  counter-increment: step-counter;
  position: relative;
  padding-left: 3rem;
  margin-bottom: 1.25rem;
}

.steps-list li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  background: var(--primary);
  color: white;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* Warning Section */
.section-warning {
  background: #fef3c7;
  padding: 1.5rem;
  border-radius: 8px;
  border-left: 4px solid var(--warning);
}

.warning-list {
  list-style: none;
  margin-left: 0;
}

.warning-list li::before {
  content: '⚠️ ';
  margin-right: 0.5rem;
}

/* Takeaways */
.section-takeaways {
  background: #dcfce7;
  padding: 1.5rem;
  border-radius: 8px;
  border-left: 4px solid var(--success);
}

.takeaways-list {
  list-style: none;
  margin-left: 0;
}

.takeaways-list li::before {
  content: '✅ ';
  margin-right: 0.5rem;
}

/* Glossary */
.glossary-terms {
  background: var(--code-bg);
  padding: 1.5rem;
  border-radius: 8px;
}

.glossary-terms dt {
  font-weight: 700;
  color: var(--primary);
  margin-top: 1rem;
  font-size: 1.125rem;
}

.glossary-terms dt:first-child {
  margin-top: 0;
}

.glossary-terms dd {
  margin-left: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

/* Diagram */
.ascii-diagram {
  background: var(--code-bg);
  padding: 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'Courier New', monospace;
  font-size: 0.9375rem;
  line-height: 1.5;
  white-space: pre;
}

/* Error Box */
.error-box {
  background: #fee2e2;
  border: 2px solid var(--danger);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
}

.error-box h2 {
  color: var(--danger);
  margin-bottom: 1rem;
}

.error-box a {
  color: var(--primary);
  font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .main-header h1 {
    font-size: 2rem;
  }

  .topic-page {
    padding: 1.5rem;
  }

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