:root {
  --bg-main: #0b0f14;
  --bg-accent: #111827;
  --panel: #161b22;
  --panel-2: #0d1117;
  --text: #e6edf3;
  --muted: #94a3b8;
  --line: #2b3440;
  --blue: #58a6ff;
  --green: #3fb950;
  --amber: #fbbf24;
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow: 0 20px 35px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, rgba(88, 166, 255, 0.15), transparent 35%),
    radial-gradient(circle at 90% 20%, rgba(63, 185, 80, 0.12), transparent 28%),
    linear-gradient(130deg, var(--bg-main) 0%, #090c10 35%, #0f172a 100%);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  line-height: 1.55;
  padding: 28px 16px 40px;
}

.shell {
  max-width: 1100px;
  margin: 0 auto;
}

.page-head {
  text-align: center;
  margin-bottom: 24px;
}

.page-head h1 {
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.page-head p {
  color: var(--muted);
  margin-top: 6px;
}

.mac-window {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--panel-2);
}

.titlebar {
  background: linear-gradient(to bottom, #2a2f36, #1f232a);
  border-bottom: 1px solid #1b2026;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
}

.dots {
  display: flex;
  gap: 8px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.titlebar .filename {
  font-family: "JetBrains Mono", "Cascadia Code", monospace;
  font-size: 0.85rem;
  color: #d0d7de;
}

.titlebar .chip {
  margin-left: auto;
  border: 1px solid #3b4655;
  color: var(--blue);
  font-size: 0.72rem;
  border-radius: 999px;
  padding: 4px 10px;
  font-family: "JetBrains Mono", "Cascadia Code", monospace;
}

.terminal {
  padding: 20px;
  background: repeating-linear-gradient(
      to bottom,
      rgba(148, 163, 184, 0.03),
      rgba(148, 163, 184, 0.03) 1px,
      transparent 1px,
      transparent 28px
    ),
    var(--panel-2);
}

.meta-line {
  color: var(--muted);
  font-family: "JetBrains Mono", "Cascadia Code", monospace;
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.prompt {
  color: var(--green);
  font-family: "JetBrains Mono", "Cascadia Code", monospace;
  margin-bottom: 8px;
}

.prompt code {
  color: #d2e7ff;
}

.panel {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
}

.panel h2 {
  font-size: 1rem;
  margin-bottom: 8px;
  color: #d2e7ff;
}

.panel p,
.panel li {
  color: #c9d1d9;
  font-size: 0.95rem;
}

.panel ul {
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.topic-note {
  font-size: 0.9rem;
  margin-top: 1rem;
  color: var(--muted);
}

.topic-note a {
  color: #8bc5ff;
}

.example {
  margin-top: 10px;
  border: 1px solid #3b4655;
  border-radius: 8px;
  overflow: hidden;
}

.example .head {
  font-size: 0.75rem;
  color: var(--amber);
  font-family: "JetBrains Mono", "Cascadia Code", monospace;
  background: #11161d;
  border-bottom: 1px solid #2c3644;
  padding: 6px 10px;
}

.practice-shell {
  margin-top: 10px;
  border: 1px solid #3b4655;
  border-radius: 8px;
  overflow: hidden;
  background: #0f141b;
}

.practice-head {
  font-size: 0.75rem;
  color: var(--amber);
  font-family: "JetBrains Mono", "Cascadia Code", monospace;
  background: #11161d;
  border-bottom: 1px solid #2c3644;
  padding: 6px 10px;
}

.practice-editor {
  width: 100%;
  min-height: 170px;
  border: 0;
  outline: none;
  resize: vertical;
  padding: 12px;
  background: #0d1117;
  color: #9cd1ff;
  font-size: 0.86rem;
  font-family: "JetBrains Mono", "Cascadia Code", monospace;
}

.practice-code-area {
  display: flex;
  min-height: 220px;
  max-height: 420px;
  position: relative;
  border-top: 1px solid #2c3644;
  border-bottom: 1px solid #2c3644;
}

.practice-line-nums {
  width: 44px;
  padding: 12px 8px 12px 0;
  text-align: right;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
  user-select: none;
  border-right: 1px solid #2c3644;
  overflow: hidden;
  background: #0f141b;
}

.practice-syntax-highlight {
  flex: 1;
  background: #0d1117;
  color: #9cd1ff;
  border: none;
  padding: 12px;
  font-family: "JetBrains Mono", "Cascadia Code", monospace;
  font-size: 0.86rem;
  line-height: 1.6;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  position: absolute;
  top: 0;
  left: 44px;
  right: 0;
  bottom: 0;
  z-index: 1;
  pointer-events: none;
}

.practice-code-area .practice-editor {
  background: transparent;
  color: transparent;
  border: none;
  resize: none;
  outline: none;
  tab-size: 2;
  overflow-y: auto;
  position: absolute;
  top: 0;
  left: 44px;
  right: 0;
  bottom: 0;
  z-index: 2;
  caret-color: var(--green);
  line-height: 1.6;
}

.practice-syntax-highlight .hljs {
  background: transparent !important;
  padding: 0 !important;
}

.practice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid #2c3644;
  border-bottom: 1px solid #2c3644;
  background: #101721;
}

.practice-output {
  min-height: 90px;
  white-space: pre-wrap;
  color: #c9f8c9;
}

pre {
  margin: 0;
  padding: 12px;
  overflow: auto;
  font-size: 0.86rem;
  font-family: "JetBrains Mono", "Cascadia Code", monospace;
  color: #9cd1ff;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.topic-link {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #0f141b;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.topic-link:hover {
  transform: translateY(-2px);
  border-color: #4f8ccf;
  box-shadow: 0 10px 18px rgba(31, 111, 235, 0.2);
}

.topic-link small {
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
  font-family: "JetBrains Mono", "Cascadia Code", monospace;
}

.nav-row {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  text-decoration: none;
  border: 1px solid #3b4655;
  color: #d2e7ff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  background: #111827;
}

.btn:hover {
  border-color: #58a6ff;
}

.part-title {
  margin-top: 18px;
  color: #8bc5ff;
  font-size: 1rem;
}

.footer-note {
  text-align: center;
  margin-top: 14px;
  color: #7c8ca0;
  font-size: 0.85rem;
}

@media (max-width: 680px) {
  .terminal {
    padding: 14px;
  }

  .titlebar {
    padding: 10px;
  }

  .titlebar .filename {
    font-size: 0.75rem;
  }
}
