# Elven Lineage Oracle

A static, browser-based Random Elf Generator for Averall. Open `index.html`
through the Webtools host or any static HTTP server. No Python service, model
connection, package installation, or build step is required by the browser.

The Oracle preserves Claude's gemstone-eye presentation, adapts Orion's
weighted generation and editable tables, and expands the output with Celine's
Appearance examples. JMC's later clarifications govern the combined version.
All lore and generated characters remain **working drafts**.

## Use

- Choose an era, population profile, expressed lineage, and gender override.
- **Summon an Elf** draws a fresh seed. **Apply seed** repeats a chosen seed
  with the current settings and locks.
- Inspect **Overview**, **Appearance**, and **Export**.
- Lock ancestry, name, body, face/senses, hairstyle, or role/story before a reroll.
  Every dependent lock also holds ancestry. Releasing ancestry releases all
  dependent locks and re-enables population controls.
- Draw one, three, or nine elves. Each batch member honours the same locks;
  the name selector changes the inspected result. Download the whole batch as
  JSON, or export the inspected character individually.
- Copy or download Markdown, JSON, or the Appearance block. When clipboard
  access is denied, the export is selected for manual copying.

The Appearance block retains the supplied `{variable} = value` convention
inside XML containers. It is not a full Ballad Character Card or a replacement
for Ballad's schema. XML text values are escaped. JSON records contain source
notes, engine/data versions, the section data, and the assembled Appearance.

## Working generation contract

### Source precedence

1. JMC's [0020] clarifications in this development conversation.
2. `Draft/elfgen/_intake/elfstuff/Elemental_Magic.md` for elemental taxonomy.
3. `Draft/elfgen/_intake/elfstuff/Elven_Lineage_Primer v0_2.md` for draft lineage,
   naming, palette, and physiology concepts.
4. Orion's activity plan, including its embedded JMC answers, and original
   Python/JSON implementation under `Draft/elfgen/_intake/orion/Random_Elf_Generator/`.
5. Celine's `ElvenPhysicality.md` as individual descriptive examples.
6. Claude's supplied `elven_generator.html` as interface, eye rendering,
   name-root, and motto precedent; preserved under `_intake/claude/`.

The intake remains a historical record. Active tables are in `Web/elfgen/data`.
They are explicit adaptations, not an automatic synchronization with intake.
The original Python program remains operable on its own original tables; its
output and random sequences are not promised to match this browser revision.

### Expression and ancestry

Select an expressed phenotype with the profile's weights, then create a
compatible full three-locus genotype. Apply `B > C > Q` consistently. Beryl
expression may carry lower-priority C/Q markers; Corundum may carry Q. Quartz
cannot acquire a dominant B/C marker while remaining Quartz-expressed.

`bb cc qq` is **recessive Quæryll ancestry**, with Spirit-Touched retained as a
traditional descriptive association. It does not automatically grant prophecy,
immortality, or access to every Spirit domain. An absence of latent dominant
markers is not proof of an unmixed family history.

The original 48/38/12/2 profile is retained as **phenotype output weighting**.
Regional weights, optional latent-locus probabilities, and homozygous versus
heterozygous choices are working generator calibration, not a population-genetics
simulation. Parentage, allele frequencies, and ancestry percentages are not inferred.

### Era, population, and attunement

Era and population are separate controls. An ancient-lineage holdout may exist
post-Calamity. Population weights are reused as provisional selection profiles
when exploring the earlier era; they are not historical census estimates.

- Post-Calamity gender weighting: female 2, male 1.
- Pre-Calamity gender weighting: female 1, male 1.
- Crimson-eye selection receives a 0.15 multiplier after the Calamity. This
  implements the direction of JMC's note; the precise multiplier is provisional.
- Every generated elf has one to three **unique Primal attunements**.
- Ancient-lineage Primal-linked eye shades always supply an attunement.
  Pale/black shades associated with Spirit do not specify a Primal, so one is
  selected separately. The eventual inheritance rule for those cases remains open.
- Modern mixed populations use the eye hint less strictly and draw multiple
  attunements more often. Exact rates are editable in `rules.json`.
- **Nature**, **Fire**, **Water**, **Air**, **Current**, and **Earth** are the
  Primals. Older Earth-as-growth labels map to Nature; Lightning maps to Current.
- **Light/Dark** are Spirit associations. Force is a separate Source domain.
  None is automatically granted as a Primal or an acquired spell.
- Channeling attuned Primals is natural, low-effort, and necessary for long-term
  health. Gestures/practices are examples, not required incantations or a fixed
  exercise schedule. Mana costs, damage, and game statistics are not generated.
- Personal Æran quirks are illustrative traits, not lineage-wide physiology.

Mottos and gemstone/mineral names retain draft setting language. The generator
makes no claim that these palette families reproduce real mineral taxonomy.

### Appearance

`physicality.json` extracts nine individually attributed example records from
Celine's source. The engine uses a coherent body example and a coherent hair
arrangement, with related details kept together. It varies facial details,
markings, sensory descriptions, height, weight, and adult age separately.

Physical ranges and the 110–240 year age band are temporary adult character-seed
calibration, not species limits or a claim about age categories. Names come from
name tables, not Celine's nine example names. Six female and three male examples
do not themselves define output ratios. The description avoids treating a
concealed organ as always externally visible. Lineage does not dictate temperament.

## Files and repeatability

- `index.html`, `styles.css`, `app.js`: browser interface; no external runtime libraries.
- `engine.js`: DOM-independent generator and serializers; usable in Node or the browser.
- `data/*.json`: active rules, palettes, profile weights, names, and examples.
- `_activity.md`: decisions, provenance, validation, and future work.
- `tools/check.js`: meaningful invariants and distribution smoke checks.

A section-specific seeded PRNG isolates ancestry, name, body, face, hair, and
story. Decorative stars use a separate stream. A lock carries its original
section seed into the new recipe. Repeatability requires the same engine/data
versions; it does not promise that later table revisions produce identical elves.

Programmatic replay (load the seven tables as `app.js` or `tools/check.js` does):

```js
const restored = ElfEngine.replay(data, exportedRecord.recipe);
```

Validation:

```sh
node --check Web/elfgen/engine.js
node --check Web/elfgen/app.js
node Web/elfgen/tools/check.js
```

The implementation is deliberately independent of Silverwall's viewer and does
not add generated elves to canonical Setting records.
