: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;
}

/* Electric field sims (no external controls) */
.sim-section h2 { color: var(--accent-2); margin-top: 1.2rem; }

.sim-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 12px;
}

.sim-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  display: grid;
  gap: 12px;
}

.sim-head { display: flex; align-items: center; }
.sim-head h3 { margin: 0; font-size: clamp(1.05rem, 2.2vw, 1.25rem); color: var(--text); }

.sim-wrap {
  position: relative;
}

.sim-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: crosshair;
  touch-action: none; /* allow smooth pointer handling on mobile */
}

.sim-hint {
  position: absolute;
  left: 10px;
  bottom: 10px;
  font-size: 0.9rem;
  color: white;
  background: rgb(0, 0, 0);
  padding: 6px 8px;
  border-radius: 8px;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}
