:root {
  --bg: #0e1116; --panel: #161b24; --panel2: #1d2430; --line: #2a3444;
  --text: #e6edf3; --dim: #8b98a9;
  --a: #ffd166; --b: #4da6ff; --c: #5dbb63;
  --fire: #ff6b35; --water: #4da6ff; --grass: #5dbb63; --danger: #ef476f;
  --accent: var(--a);
}
body.secA { --accent: var(--a); }
body.secB { --accent: var(--b); }
body.secC { --accent: var(--c); }

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 16px; line-height: 1.65;
}
a { color: var(--accent); }

/* ------------------------------------------------------------- sidebar */
#sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 250px;
  background: var(--panel); border-right: 1px solid var(--line);
  padding: 20px 0; overflow-y: auto; z-index: 5;
}
#sidebar .brand {
  display: block; padding: 0 18px 14px; font-weight: bold; letter-spacing: 2px;
  color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}
#sidebar .navsec {
  padding: 12px 18px 4px; font-size: 11px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--dim);
}
#sidebar a:not(.brand) {
  display: block; padding: 6px 18px; color: var(--text);
  text-decoration: none; font-size: 13px; border-left: 3px solid transparent;
}
#sidebar a:not(.brand):hover { background: var(--panel2); }
#sidebar a.active { border-left-color: var(--accent); background: var(--panel2); color: var(--accent); }
#menuBtn { display: none; }

/* ------------------------------------------------------------- content */
main { margin-left: 250px; padding: 40px 48px 80px; max-width: 1000px; }
h1 {
  font-size: 42px; line-height: 1.15; margin-bottom: 8px; letter-spacing: 1px;
  border-left: 6px solid var(--accent); padding-left: 18px;
}
.kicker { color: var(--dim); font-size: 13px; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 6px; }
.lede { color: var(--dim); font-size: 18px; margin: 10px 0 30px; max-width: 760px; }
h2 { font-size: 24px; margin: 42px 0 12px; color: var(--accent); }
h3 { font-size: 17px; margin: 26px 0 8px; }
p { margin: 10px 0; max-width: 780px; }
ul, ol { margin: 10px 0 10px 26px; max-width: 760px; }
li { margin: 5px 0; }
strong { color: var(--accent); }
table { border-collapse: collapse; margin: 14px 0; font-size: 14px; }
th, td { border: 1px solid var(--line); padding: 7px 12px; text-align: left; }
th { background: var(--panel2); }
hr { border: 0; border-top: 1px solid var(--line); margin: 30px 0; }

/* ------------------------------------------------------------- code */
.codeblock { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin: 16px 0; overflow: hidden; }
.codehead {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 14px; background: var(--panel2); border-bottom: 1px solid var(--line);
  font-size: 12px; color: var(--dim);
}
.codehead a { margin-right: 12px; font-size: 12px; }
.copybtn {
  background: none; border: 1px solid var(--line); color: var(--dim);
  border-radius: 6px; padding: 2px 10px; font: inherit; font-size: 12px; cursor: pointer;
}
.copybtn:hover { color: var(--text); border-color: var(--dim); }
pre { padding: 14px 16px; overflow-x: auto; font-size: 13px; line-height: 1.5; }
code { font-family: inherit; }
p code, li code, td code {
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 6px; font-size: 14px;
}
pre.output {
  background: #0a0d12; border: 1px dashed var(--line); border-radius: 10px;
  margin: 10px 0 18px; color: #9fd89f; font-size: 13px;
}
.outlabel { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--dim); margin-top: 14px; }

/* ------------------------------------------------------------- callouts */
.box { border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: 8px; background: var(--panel); padding: 14px 18px; margin: 18px 0; max-width: 800px; }
.box.warn { border-left-color: var(--danger); }
.box.check { border-left-color: var(--grass); }
.box .boxtitle { font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; }
.box.check .boxtitle { color: var(--grass); }
.box.warn .boxtitle { color: var(--danger); }

/* steps */
.stepnum { display: inline-block; background: var(--accent); color: #0e1116; font-weight: bold; border-radius: 50%; width: 26px; height: 26px; text-align: center; line-height: 26px; margin-right: 10px; font-size: 14px; }

/* os tabs */
.tabs { display: flex; gap: 6px; margin: 14px 0 0; }
.tabs button { background: var(--panel2); border: 1px solid var(--line); border-bottom: none; color: var(--dim); padding: 7px 16px; border-radius: 8px 8px 0 0; font: inherit; font-size: 13px; cursor: pointer; }
.tabs button.active { color: var(--accent); border-color: var(--accent); }
.tabpane { display: none; border: 1px solid var(--line); border-radius: 0 10px 10px 10px; padding: 4px 18px 14px; background: var(--panel); }
.tabpane.active { display: block; }

/* diagrams */
figure.diagram { margin: 22px 0; text-align: center; }
figure.diagram svg { max-width: 100%; height: auto; }
figure.diagram figcaption { color: var(--dim); font-size: 12px; margin-top: 6px; }

/* ------------------------------------------------- slide (presentation top) */
.slide {
  display: flex; flex-direction: column; justify-content: center;
  min-height: calc(100vh - 130px);
  border-bottom: 1px solid var(--line);
  margin-bottom: 36px; padding-bottom: 30px; position: relative;
}
.slide .lede { margin-bottom: 6px; }
.slide-points { list-style: none; margin: 20px 0 0 0; max-width: 840px; }
.slide-points li {
  font-size: 21px; line-height: 1.5; margin: 13px 0;
  padding-left: 32px; position: relative;
}
.slide-points li::before { content: "▸"; color: var(--accent); position: absolute; left: 0; }
.slide-points code { font-size: 18px; }
.scrollhint {
  position: absolute; bottom: 8px; left: 0;
  color: var(--dim); font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
}
.slide-mascot {
  position: absolute; right: 26px; bottom: 46px; text-align: center;
  animation: mascot-bob 3.2s ease-in-out infinite;
}
.slide-mascot svg { width: 150px; height: 150px; filter: drop-shadow(0 6px 16px #0009); }
.slide-mascot .mlabel { color: var(--dim); font-size: 11px; letter-spacing: 1px; margin-top: 2px; }
@keyframes mascot-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@media (max-width: 1150px) {
  .slide-mascot { right: 12px; bottom: 40px; }
  .slide-mascot svg { width: 110px; height: 110px; }
}

/* prev / next */
.prevnext { display: flex; justify-content: space-between; margin-top: 60px; border-top: 1px solid var(--line); padding-top: 18px; }
.prevnext a { text-decoration: none; font-size: 14px; }

/* index hero demo board */
#demoboard { display: grid; gap: 4px; max-width: 640px; margin: 20px 0; }
#demoboard .cell { aspect-ratio: 1; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; display: flex; align-items: center; justify-content: center; position: relative; }
#demoboard .cell.mine { border-color: #3d6cb3; }
#demoboard .cell.enemy { border-color: #7e2b3d; }
#demoboard .cell svg { width: 82%; height: 82%; }
#demoboard .power { position: absolute; bottom: 1px; right: 4px; font-size: 10px; color: var(--a); }

.pill { display: inline-block; border: 1px solid var(--line); border-radius: 20px; padding: 2px 12px; font-size: 12px; color: var(--dim); margin: 2px 4px 2px 0; }

/* species gallery */
.gallery { display: grid; grid-template-columns: repeat(4, minmax(110px, 140px)); gap: 12px; margin: 18px 0 8px; }
.gcell { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px 8px; text-align: center; }
.gcell.fire  { border-bottom: 3px solid var(--fire); }
.gcell.water { border-bottom: 3px solid var(--water); }
.gcell.grass { border-bottom: 3px solid var(--grass); }
.gcell svg { width: 84%; height: auto; }
.glabel { font-size: 12px; margin-top: 4px; }
.glabel span { color: var(--dim); font-size: 11px; }
@media (max-width: 1150px) { .gallery { grid-template-columns: repeat(4, 1fr); gap: 8px; } }

/* Collapses at half-screen widths too — built for screen-share:
   site on one half of the screen, terminal/editor on the other. */
@media (max-width: 1150px) {
  #sidebar { transform: translateX(-100%); transition: transform 0.2s; }
  #sidebar.open { transform: none; }
  #menuBtn { display: block; position: fixed; top: 12px; left: 12px; z-index: 6;
    background: var(--panel2); color: var(--text); border: 1px solid var(--line);
    border-radius: 8px; padding: 6px 12px; font: inherit; }
  main { margin-left: 0; padding: 60px 28px 60px; }
  h1 { font-size: 32px; }
  .slide-points li { font-size: 19px; }
}
