:root {
  --bg: #0f1115;
  --panel: #151924;
  --text: #e6e8ef;
  --muted: #a7aec0;
  --accent: #7aa2f7;
  --accent-2: #9ece6a;
  --border: #23283b;
  --shadow: 0 10px 30px rgba(0,0,0,.25);
  --radius: 16px;
  --maxw: 900px;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  background: radial-gradient(1200px 800px at 10% -10%, #14192a 0%, var(--bg) 40%) fixed;
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

header.site {
  max-width: var(--maxw);
  margin: 28px auto 0;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.02);
  transition: all .2s ease;
}
.back:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}

.title {
  margin: 0 0 0 auto;
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  color: var(--text);
  opacity: .95;
  letter-spacing: .2px;
}

main {
  max-width: var(--maxw);
  margin: 18px auto 64px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.00));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

h1, h2, h3 {
  line-height: 1.25;
  margin: 1.2em 0 .4em;
  font-weight: 750;
}

h1 {
  font-size: clamp(1.6rem, 3.8vw, 2.2rem);
}
h2 {
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  color: var(--accent-2);
}

p {
  margin: .7em 0;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0 24px;
}

.note {
  border-left: 4px solid var(--accent);
  padding: 12px 16px;
  margin: 18px 0;
  background: rgba(122,162,247,0.06);
  border-radius: 10px;
  color: var(--text);
}

.def {
  border-left: 4px solid var(--accent-2);
  padding: 12px 16px;
  margin: 18px 0;
  background: rgba(158,206,106,0.06);
  border-radius: 10px;
}

.math-block {
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
}

footer {
  max-width: var(--maxw);
  margin: 0 auto 32px;
  padding: 0 24px;
  color: var(--muted);
  font-size: .9rem;
  text-align: center;
}
/* --- Math display tweaks (no scroll bars) --- */
.math-block {
  overflow-x: visible;     /* let MathJax breathe */
  white-space: normal;     /* avoid forced single-line layout */
  text-align: center;
}

/* Ensure MathJax containers don’t introduce overflow */
.math-block mjx-container[display="true"] {
  overflow-x: visible;
  max-width: 100%;
}

/* Optional: nicer spacing for lists inside notes/defs */
.note ul, .note ol, .def ul, .def ol {
  margin: .5em 0 .2em 1.2em;
}

.topic-figure {
  margin: 1.2em auto;
  text-align: center;
}

.topic-figure img.topic-img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
