/* ==================== THE LAVA GAME — DOCS ====================
   One stylesheet, two contexts:
     body.dx-standalone   the docs.html page
     #dx-overlay          the in-game panel, semi-transparent over the world

   Design brief: minimal and quiet. The previous pass was bullet-heavy with
   bold lead-ins and boxed callouts everywhere — busy, and it read as filler.
   This is editorial: prose, hairline rules, one accent, lots of air.
   ========================================================================= */

/* Background on html AND body. On the first pass only body carried it, which
   left a white band above the sticky header. */
html.dx-standalone-root, body.dx-standalone {
  background: #150d0e;
}

body.dx-standalone {
  margin: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(199, 48, 10, 0.16) 0%, transparent 70%),
    #150d0e;
  min-height: 100vh;
}

.dx-standalone,
#dx-overlay {
  color: var(--lf-ash, #c7afa4);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 15.5px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

/* ==================== TOP BAR (standalone only) ==================== */

.dx-top {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 20px;
  padding: 16px 34px;
  background: rgba(21, 13, 14, 0.92);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.dx-brand {
  font-family: 'Archivo Black', sans-serif; font-size: 15px;
  letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--lf-bone, #f6ede6); text-decoration: none;
}
.dx-brand span { color: var(--lf-lava, #ff7a22); }
.dx-nav { display: flex; gap: 4px; }
.dx-nav a {
  font-size: 13.5px; color: var(--lf-smoke, #8a756d);
  padding: 5px 11px; border-radius: 6px; text-decoration: none;
}
.dx-nav a:hover { color: var(--lf-bone, #f6ede6); }
.dx-nav a.on { color: var(--lf-lava-core, #ffc24a); }
.dx-spacer { flex: 1; }
.dx-play {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--lf-lava-core, #ffc24a); text-decoration: none;
  border: 1px solid rgba(255, 122, 34, 0.34);
  padding: 7px 16px; border-radius: 7px;
}
.dx-play:hover { background: rgba(255, 122, 34, 0.12); }

/* ==================== LAYOUT ==================== */

.dx-wrap {
  max-width: 1000px; margin: 0 auto; padding: 44px 34px 120px;
  display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 56px;
}

/* ==================== SIDEBAR ==================== */

.dx-side { position: sticky; top: 86px; align-self: start; max-height: calc(100vh - 120px); overflow-y: auto; }
.dx-side::-webkit-scrollbar { width: 3px; }
.dx-side::-webkit-scrollbar-thumb { background: rgba(255, 122, 34, 0.22); }

.dx-group {
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  letter-spacing: 2.2px; text-transform: uppercase;
  color: var(--lf-soot, #5c4a46);
  margin: 26px 0 8px; padding-left: 1px;
}
.dx-group:first-child { margin-top: 0; }

.dx-side a {
  display: block; font-size: 13.5px; line-height: 1.5;
  color: var(--lf-smoke, #8a756d);
  padding: 4px 0 4px 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.07);
  text-decoration: none;
  transition: color .14s ease, border-color .14s ease;
}
.dx-side a:hover { color: var(--lf-bone, #f6ede6); }
.dx-side a.on {
  color: var(--lf-lava-core, #ffc24a);
  border-left-color: var(--lf-lava, #ff7a22);
}

/* ==================== CONTENT ==================== */

.dx-doc { max-width: 66ch; }

.dx-eyebrow {
  font-family: 'JetBrains Mono', monospace; font-size: 9.5px;
  letter-spacing: 2.4px; text-transform: uppercase;
  color: var(--lf-lava, #ff7a22); margin: 0 0 12px;
}

.dx-doc h1 {
  font-family: 'Archivo Black', sans-serif;
  font-size: 30px; line-height: 1.18; letter-spacing: 0.2px;
  color: var(--lf-bone, #f6ede6); margin: 0 0 14px;
}

.dx-lede {
  font-size: 17px; line-height: 1.65;
  color: var(--lf-ash, #c7afa4); margin: 0 0 34px;
}

/* Section headings sit on a hairline instead of inside a card. Quieter, and
   it gives the eye a clean horizontal rhythm down the page. */
.dx-doc section { border-top: 1px solid rgba(255, 255, 255, 0.07); padding-top: 30px; margin-top: 30px; }

.dx-doc h2 {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 13px; font-weight: 600;
  letter-spacing: 1.8px; text-transform: uppercase;
  color: var(--lf-lava-core, #ffc24a);
  margin: 0 0 14px; scroll-margin-top: 96px;
}

.dx-doc p { margin: 0 0 15px; }
.dx-doc p:last-child { margin-bottom: 0; }
.dx-doc b, .dx-doc strong { color: var(--lf-bone, #f6ede6); font-weight: 600; }

/* Fact strip — definition list, no boxes */
.dx-facts {
  display: flex; flex-wrap: wrap; gap: 0 34px;
  margin: 0 0 34px; padding: 16px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.dx-facts div { display: flex; flex-direction: column; }
.dx-facts dt {
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  letter-spacing: 1.8px; text-transform: uppercase;
  color: var(--lf-soot, #5c4a46);
}
.dx-facts dd {
  margin: 2px 0 0; font-size: 14.5px;
  color: var(--lf-bone, #f6ede6); font-weight: 500;
}

/* Tables — hairlines only */
.dx-doc table { width: 100%; border-collapse: collapse; margin: 4px 0 16px; font-size: 14.5px; }
.dx-doc td { padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.055); vertical-align: top; }
.dx-doc td:first-child {
  width: 34%; padding-right: 22px;
  color: var(--lf-bone, #f6ede6); font-weight: 500;
}
.dx-doc tr:last-child td { border-bottom: none; }
.dx-keys td:first-child { width: 40%; }

/* A single note style — thin rule, no fill. There is one accent on this page
   and it is used sparingly. */
.dx-note {
  border-left: 2px solid rgba(255, 122, 34, 0.55);
  padding: 2px 0 2px 16px; margin: 18px 0;
  color: var(--lf-ash, #c7afa4);
}
.dx-note.dx-warn { border-left-color: rgba(229, 72, 77, 0.6); }

kbd {
  font-family: 'JetBrains Mono', monospace; font-size: 11.5px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 4px; padding: 2px 7px; margin-right: 3px;
  color: var(--lf-bone, #f6ede6);
}

.dx-cta { margin-top: 22px; }
.dx-cta a {
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--lf-lava-core, #ffc24a); text-decoration: none;
  border-bottom: 1px solid rgba(255, 122, 34, 0.4);
  padding-bottom: 3px;
}
.dx-cta a:hover { border-bottom-color: var(--lf-lava-core, #ffc24a); }

/* ==================== IN-GAME OVERLAY ==================== */
/* Semi-transparent so the world stays visible behind. Opacity is a balance:
   too low and body text becomes unreadable over a moving 3D scene, so the
   blur does the heavy lifting rather than the alpha. */

#dx-overlay {
  position: fixed; inset: 0; z-index: 9500;
  display: none;
  background: rgba(20, 12, 13, 0.80);
  backdrop-filter: blur(16px) saturate(0.9);
  -webkit-backdrop-filter: blur(16px) saturate(0.9);
  animation: dxFade .18s ease;
}
#dx-overlay.open { display: block; }

@keyframes dxFade { from { opacity: 0 } to { opacity: 1 } }

#dx-overlay-scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; }
#dx-overlay-scroll::-webkit-scrollbar { width: 5px; }
#dx-overlay-scroll::-webkit-scrollbar-thumb { background: rgba(255, 122, 34, 0.26); border-radius: 3px; }

#dx-overlay .dx-wrap { padding-top: 78px; }

#dx-overlay-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; gap: 14px;
  padding: 15px 30px;
  background: rgba(20, 12, 13, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
#dx-overlay-bar .t {
  font-family: 'Archivo Black', sans-serif; font-size: 13px;
  letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--lf-bone, #f6ede6);
}
#dx-overlay-bar .t span { color: var(--lf-lava, #ff7a22); }
#dx-overlay-bar .s {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 1.8px; text-transform: uppercase;
  color: var(--lf-soot, #5c4a46);
}
#dx-overlay-close {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  letter-spacing: 1.4px; text-transform: uppercase;
  background: transparent; color: var(--lf-smoke, #8a756d);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px; padding: 7px 15px; cursor: pointer;
  transition: all .15s ease;
}
#dx-overlay-close:hover {
  color: var(--lf-lava-core, #ffc24a);
  border-color: rgba(255, 122, 34, 0.4);
}

/* ==================== DOCS LAUNCHER (top-left, beside the population pill) ==================== */

/* Sized to match #cg-pop exactly — same padding, radius, surface and blur, so
   the two pills read as one row of chrome rather than two mismatched widgets. */
#dx-launch {
  position: fixed; z-index: 96;
  display: inline-flex; align-items: center; gap: 10px;
  /* #cg-pop is 1px border + 11px pad + a 24px/1 number + 11px pad + 1px border
     = 48px tall. Matching padding alone leaves this pill short, because its
     content is 9px text — so the height is set explicitly. */
  box-sizing: border-box;
  min-height: 48px;
  padding: 0 19px;
  border-radius: 13px;
  background: var(--card, rgba(24, 15, 16, 0.86));
  border: 1px solid var(--hair, rgba(255, 255, 255, 0.09));
  box-shadow: var(--card-shadow, 0 8px 28px rgba(0,0,0,0.45));
  backdrop-filter: var(--card-blur, blur(14px));
  -webkit-backdrop-filter: var(--card-blur, blur(14px));
  /* .pl in #cg-pop is 9px/1.3 mono, letter-spacing 1.5px — match it so the
     two pills have the same optical weight, not just the same box. */
  font: 500 9px/1.3 var(--mono, 'JetBrains Mono', monospace);
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--t2, #8a756d);
  cursor: pointer; user-select: none;
  transition: all .15s ease;
}
#dx-launch i {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--lf-lava, #ff7a22);
  box-shadow: 0 0 11px var(--lf-lava, #ff7a22);
  font-style: normal;
}
#dx-launch:hover {
  color: var(--lf-lava-core, #ffc24a);
  border-color: rgba(255, 122, 34, 0.42);
}
#dx-launch i {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--lf-lava, #ff7a22); font-style: normal;
}
/* hidden during a match */
body[data-in-game="1"] #dx-launch { display: none; }

@media (max-width: 900px) {
  .dx-wrap { grid-template-columns: 1fr; gap: 26px; padding: 28px 22px 80px; }
  .dx-side { position: static; max-height: none; }
  .dx-doc h1 { font-size: 25px; }
}