:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-alt: #f0f4f6;
  --text: #18242e;
  --muted: #5d707e;
  --line: #d9e2e8;
  --accent: #0a7a6a;
  --accent-soft: #d4f0ea;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 0%, #e9f4f2, var(--bg) 35%);
}

.layout {
  min-height: 100%;
  display: grid;
  grid-template-columns: 320px 1fr;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #f9fcfc, #eef4f7);
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}

.brand img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.kicker {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand h1 {
  margin: 2px 0 0;
  font-size: 18px;
}

.controls {
  margin-bottom: 14px;
}

.controls label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

.controls select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 8px;
}

#topic-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#topic-list li {
  margin: 4px 0;
}

#topic-list li.section-label {
  margin-top: 14px;
  margin-bottom: 6px;
  padding: 0 10px;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

#topic-list button {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

#topic-list button:hover {
  background: var(--surface-alt);
}

#topic-list button.active {
  background: var(--accent-soft);
  border-color: #9ed9ce;
}

.content {
  padding: 30px 6vw;
}

.content-header h2 {
  margin: 0 0 20px;
  font-size: 30px;
}

#topic-content {
  max-width: 900px;
}

#topic-content h1,
#topic-content h2 {
  line-height: 1.2;
}

#topic-content p {
  line-height: 1.6;
  white-space: pre-line;
}

#topic-content ul {
  padding-left: 22px;
  line-height: 1.5;
}

#topic-content pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  background: #11212b;
  color: #cde3ef;
  border-radius: 10px;
  padding: 14px;
}

#topic-content img {
  display: block;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 10px 0 18px;
}

#topic-content a {
  color: #0b5ea9;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .content {
    padding: 20px 14px 40px;
  }

  .content-header h2 {
    font-size: 24px;
  }
}
