Prompt specification
Build or customize the Three.js 3D scene "Same phenotype different genotype comparison" inside the active workspace.
Engineering Constraints:
1. Runtime & Orbit: Use Three.js r160 with OrbitControls (damping enabled) and ACESFilmicToneMapping.
2. Frame Timing: Drive all motion strictly with clock.getDelta() so animation speed is FPS-independent.
3. Viewport Hygiene: Handle window resize cleanly, cap DPR at Math.min(window.devicePixelRatio, 2), and dispose geometries/materials/renderer on unmount.
Scene Metadata:
Scene: Same phenotype different genotype comparison
Category: Biology & Nature · Style: Procedural Solid / Shader 3D
License: MIT · Reference: https://three3d.app/scene/same-phenotype-different-genotype-comparison-x0882
Scene Description Prompt:
Please create one self-contained HTML file with Three.js from cdnjs showing two identical-looking fictional plants with different allele pairs, using smooth stylized forms. Put the plants in matching pots above token trays labeled AA and Aa, and state that this example uses a simple single-locus dominance model. Let each be paired with an aa tester, then show the possible offspring token combinations and their corresponding visible trait in separate rows. The two parent plants should remain visually identical throughout. Keep the genotype tokens distinct from the displayed phenotype, and make clear that the chosen inheritance rule applies to this toy example rather than every biological trait.
Acceptance checks: Use AA × aa → all Aa, and Aa × aa → half Aa and half aa in the declared complete-dominance example. Check the actual token rows against these results in both states. Preserve the identical parent phenotype and keep the displayed phenotype separate from the genotypes.
Return a single complete HTML document. It must work in a sandbox that allows scripts, with the cdnjs Three.js r160 module and inline CSS. Use procedural geometry and local button handlers; no native form submission, pointer lock, remote assets, or runtime network requests besides Three.js.
Working Three.js Starter (same-phenotype-different-genotype-comparison-x0882):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="An interactive Three.js demonstration of complete dominance in a fictional plant.">
<link rel="icon" href="data:,">
<title>Luma Plant Inheritance Lab</title>
<style>
:root {
color-scheme: dark;
--bg: #08111f;
--panel: rgba(17, 29, 48, 0.9);
--panel-strong: #13233a;
--line: rgba(166, 196, 224, 0.18);
--text: #edf7ff;
--muted: #a8bbcf;
--teal: #43ddc4;
--teal-deep: #176f68;
--lilac: #c49bf3;
--lilac-deep: #68458f;
--gold: #ffd976;
--pass: #6ee7b7;
--fail: #fb7185;
--genotype: #0b1425;
}
* {
box-sizing: border-box;
}
body {
margin: 0;
min-width: 320px;
background:
radial-gradient(circle at 18% 8%, rgba(45, 123, 142, 0.2), transparent 31rem),
radial-gradient(circle at 86% 18%, rgba(115, 75, 158, 0.18), transparent 32rem),
linear-gradient(160deg, #07101c, #0b1525 55%, #0a1220);
color: var(--text);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
line-height: 1.5;
}
button,
input,
select,
textarea {
font: inherit;
}
.page {
width: min(1240px, calc(100% - 32px));
margin: 0 auto;
padding: 42px 0 54px;
}
.eyebrow {
margin: 0 0 8px;
color: var(--teal);
font-size: 0.76rem;
font-weight: 800;
letter-spacing: 0.16em;
text-transform: uppercase;
}
h1,
h2,
p {
margin-top: 0;
}
h1 {
max-width: 850px;
margin-bottom: 12px;
font-size: clamp(2.1rem, 5vw, 4.35rem);
line-height: 1.02;
letter-spacing: -0.045em;
}
.lede {
max-width: 820px;
margin-bottom: 0;
color: var(--muted);
font-size: clamp(1rem, 2vw, 1.16rem);
}
.scope-card {
display: grid;
grid-template-columns: auto 1fr;
gap: 18px;
align-items: start;
margin: 27px 0 20px;
padding: 18px 20px;
border: 1px solid rgba(67, 221, 196, 0.25);
border-radius: 18px;
background: linear-gradient(110deg, rgba(25, 72, 76, 0.42), rgba(20, 32, 52, 0.86));
box-shadow: 0 20px 55px rgba(0, 0, 0, 0.18);
}
.scope-title {
padding: 7px 10px;
border: 1px solid rgba(67, 221, 196, 0.32);
border-radius: 999px;
color: var(--teal);
font-size: 0.73rem;
font-weight: 850;
letter-spacing: 0.11em;
text-transform: uppercase;
white-space: nowrap;
}
.scope-card p {
margin: 0;
color: #d4e2ef;
}
.scope-card strong {
color: var(--text);
}
.viewer-card,
.tray {
border: 1px solid var(--line);
border-radius: 22px;
background: var(--panel);
box-shadow: 0 24px 70px rgba(0, 0, 0, 0.25);
backdrop-filter: blur(14px);
}
.viewer-card {
overflow: hidden;
}
.viewer-toolbar {
display: flex;
gap: 20px;
align-items: center;
justify-content: space-between;
padding: 16px 18px 15px 21px;
border-bottom: 1px solid var(--line);
}
.viewer-toolbar h2 {
margin: 0 0 2px;
font-size: 1rem;
}
.viewer-toolbar p {
margin: 0;
color: var(--muted);
font-size: 0.83rem;
}
.button {
min-height: 42px;
padding: 9px 15px;
border: 1px solid rgba(67, 221, 196, 0.42);
border-radius: 12px;
background: linear-gradient(135deg, #1b9f96, #176e74);
color: white;
cursor: pointer;
font-weight: 800;
box-shadow: 0 8px 22px rgba(23, 111, 116, 0.2);
transition: transform 150ms ease, filter 150ms ease;
}
.button:hover {
filter: brightness(1.09);
transform: translateY(-1px);
}
.button:active {
transform: translateY(0);
}
.button:focus-visible {
outline: 3px solid rgba(255, 217, 118, 0.75);
outline-offset: 3px;
}
.stage-scroll {
overflow-x: auto;
overscroll-behavior-inline: contain;
}
#stage {
position: relative;
width: 100%;
min-width: 880px;
height: 430px;
overflow: hidden;
background:
radial-gradient(ellipse at 50% 76%, rgba(62, 203, 190, 0.09), transparent 43%),
linear-gradient(180deg, rgba(11, 24, 42, 0.2), rgba(6, 14, 26, 0.72));
}
#stage::before {
position: absolute;
inset: 0;
z-index: 0;
background-image:
linear-gradient(rgba(151, 194, 219, 0.035) 1px, transparent 1px),
linear-gradient(90deg, rgba(151, 194, 219, 0.035) 1px, transparent 1px);
background-size: 38px 38px;
content: "";
mask-image: linear-gradient(to bottom, transparent, black 24%, black 80%, transparent);
pointer-events: none;
}
#three-canvas {
position: absolute;
inset: 0;
z-index: 1;
width: 100%;
height: 100%;
display: block;
}
.scene-label {
position: absolute;
z-index: 2;
top: 18px;
display: grid;
justify-items: center;
width: 132px;
padding: 9px 8px 8px;
border: 1px solid rgba(176, 207, 231, 0.17);
border-radius: 13px;
background: rgba(8, 17, 31, 0.76);
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
text-align: center;
pointer-events: none;
transform: translateX(-50%);
}
.scene-label .label-kicker {
color: var(--muted);
font-size: 0.62rem;
font-weight: 850;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.scene-label strong {
margin: 3px 0 1px;
color: white;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 1.13rem;
letter-spacing: 0.08em;
}
.scene-label .visible-trait {
color: var(--teal);
font-size: 0.68rem;
font-weight: 750;
}
.scene-label.tester .visible-trait {
color: var(--lilac);
}
.scene-caption {
position: absolute;
z-index: 3;
left: 50%;
bottom: 15px;
padding: 7px 12px;
border: 1px solid rgba(166, 196, 224, 0.13);
border-radius: 999px;
background: rgba(7, 15, 27, 0.76);
color: #c5d4e3;
font-size: 0.73rem;
font-weight: 700;
white-space: nowrap;
transform: translateX(-50%);
pointer-events: none;
}
.legend {
display: flex;
flex-wrap: wrap;
gap: 12px 23px;
align-items: center;
padding: 13px 20px;
border-top: 1px solid var(--line);
color: var(--muted);
font-size: 0.78rem;
}
.legend-item {
display: inline-flex;
gap: 7px;
align-items: center;
}
.legend-swatch {
width: 12px;
height: 12px;
border-radius: 4px;
}
.legend-swatch.teal {
background: var(--teal);
box-shadow: 0 0 12px rgba(67, 221, 196, 0.35);
}
.legend-swatch.lilac {
background: var(--lilac);
box-shadow: 0 0 12px rgba(196, 155, 243, 0.3);
}
.legend-swatch.genotype {
border: 2px solid #8ca8c7;
background: var(--genotype);
border-radius: 3px;
}
.check-panel {
display: grid;
grid-template-columns: auto 1fr;
gap: 4px 11px;
align-items: center;
margin: 0 18px 18px;
padding: 13px 15px;
border: 1px solid rgba(110, 231, 183, 0.2);
border-radius: 14px;
background: rgba(9, 20, 32, 0.72);
}
.check-panel .status-icon {
grid-row: 1 / span 2;
display: grid;
width: 30px;
height: 30px;
place-items: center;
border-radius: 50%;
background: rgba(110, 231, 183, 0.13);
color: var(--pass);
font-weight: 900;
}
.check-panel strong {
font-size: 0.86rem;
}
.check-panel span:last-child {
color: var(--muted);
font-size: 0.76rem;
}
.check-panel[data-pass="false"] {
border-color: rgba(251, 113, 133, 0.35);
}
.check-panel[data-pass="false"] .status-icon {
background: rgba(251, 113, 133, 0.13);
color: var(--fail);
}
.tray-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 18px;
margin-top: 18px;
}
.tray {
padding: 21px;
}
.tray-head {
display: flex;
gap: 14px;
align-items: flex-start;
justify-content: space-between;
margin-bottom: 14px;
}
.state-pill {
display: inline-block;
margin-bottom: 5px;
color: var(--teal);
font-size: 0.66rem;
font-weight: 850;
letter-spacing: 0.13em;
text-transform: uppercase;
}
.tray h2 {
margin: 0;
font-size: 1.12rem;
letter-spacing: -0.015em;
}
.equation {
display: inline-flex;
gap: 6px;
align-items: center;
padding: 8px 10px;
border: 1px solid var(--line);
border-radius: 12px;
background: rgba(5, 12, 22, 0.45);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-weight: 800;
white-space: nowrap;
}
.equation .parent-token {
color: var(--teal);
}
.equation .tester-token {
color: var(--lilac);
}
.rule-summary {
display: flex;
gap: 4px 12px;
align-items: baseline;
justify-content: space-between;
margin-bottom: 17px;
padding: 12px 14px;
border-left: 3px solid var(--teal);
border-radius: 0 11px 11px 0;
background: rgba(67, 221, 196, 0.075);
}
.rule-summary strong {
color: #eafff9;
font-size: 0.95rem;
}
.rule-summary span {
color: var(--muted);
font-size: 0.76rem;
text-align: right;
}
.outcome-line {
display: grid;
grid-template-columns: 112px minmax(0, 1fr);
gap: 12px;
align-items: center;
margin-top: 10px;
}
.line-label {
color: var(--muted);
font-size: 0.72rem;
font-weight: 800;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.line-label small {
display: block;
margin-top: 2px;
color: #7389a0;
font-size: 0.58rem;
font-weight: 650;
letter-spacing: 0;
text-transform: none;
}
.token-grid,
.phenotype-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 7px;
}
.genotype-token {
display: grid;
min-height: 48px;
place-items: center;
border: 2px solid #6e8baa;
border-radius: 10px;
background: var(--genotype);
color: white;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 1.05rem;
font-weight: 900;
letter-spacing: 0.08em;
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}
.genotype-token[data-genotype="aa"] {
border-color: var(--lilac);
color: #e9d8ff;
}
.phenotype-chip {
display: flex;
min-height: 48px;
gap: 5px;
align-items: center;
justify-content: center;
padding: 7px 6px;
border: 1px solid transparent;
border-radius: 10px;
font-size: clamp(0.61rem, 1.05vw, 0.74rem);
font-weight: 800;
line-height: 1.15;
text-align: center;
}
.phenotype-chip svg {
flex: 0 0 auto;
width: 17px;
height: 17px;
}
.phenotype-chip.dominant {
border-color: rgba(67, 221, 196, 0.33);
background: rgba(67, 221, 196, 0.12);
color: #91f3e2;
}
.phenotype-chip.recessive {
border-color: rgba(196, 155, 243, 0.35);
background: rgba(196, 155, 243, 0.12);
color: #dfc4ff;
}
.row-note {
margin: 15px 0 0;
padding-top: 13px;
border-top: 1px solid var(--line);
color: var(--muted);
font-size: 0.74rem;
}
.row-note strong {
color: #d9e8f6;
}
.footer-note {
margin: 18px 2px 0;
color: #8297ad;
font-size: 0.77rem;
text-align: center;
}
@media (max-width: 850px) {
.page {
width: min(100% - 22px, 1240px);
padding-top: 28px;
}
.tray-grid {
grid-template-columns: 1fr;
}
.scope-card {
grid-template-columns: 1fr;
gap: 10px;
}
.scope-title {
justify-self: start;
}
}
@media (max-width: 560px) {
.viewer-toolbar {
align-items: flex-start;
flex-direction: column;
}
.button {
width: 100%;
}
.tray {
padding: 16px;
}
.tray-head,
.rule-summary {
align-items: flex-start;
flex-direction: column;
}
.rule-summary span {
text-align: left;
}
.outcome-line {
grid-template-columns: 1fr;
gap: 7px;
}
.line-label small {
display: inline;
margin-left: 6px;
}
.token-grid,
.phenotype-grid {
gap: 5px;
}
.genotype-token {
min-height: 43px;
}
.phenotype-chip {
min-height: 55px;
flex-direction: column;
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
scroll-behavior: auto !important;
transition: none !important;
}
}
</style>
</head>
<body>
<main class="page">
<header>
<p class="eyebrow">Interactive inheritance model</p>
<h1>Luma plant inheritance lab</h1>
<p class="lede">
Two fictional Luma plants have the same shape, size, and visible foliage even though
their allele pairs are <strong>AA</strong> and <strong>Aa</strong>. Each is crossed
with a lilac-foliage <strong>aa</strong> tester.
</p>
</header>
<section class="scope-card" aria-labelledby="scope-heading">
<span class="scope-title" id="scope-heading">Model scope</span>
<p>
<strong>Simple single-locus complete-dominance model.</strong>
In this toy example, <strong>A</strong> is completely dominant: offspring with at least
one <strong>A</strong> allele have moon-teal foliage, while <strong>aa</strong> offspring
have lilac foliage. This rule is chosen for this fictional example; it is not a claim that
every biological trait follows complete dominance.
</p>
</section>
<section class="viewer-card" aria-labelledby="viewer-heading">
<div class="viewer-toolbar">
<div>
<h2 id="viewer-heading">Parent plants and aa testers</h2>
<p>The two larger parent plants remain visually identical under this model.</p>
</div>
<button class="button" id="verify-button" type="button">Verify actual token rows</button>
</div>
<div class="stage-scroll">
<div id="stage">
<canvas
id="three-canvas"
aria-label="Three-dimensional Luma plants: identical teal-foliage AA and Aa parents, each paired with a smaller lilac-foliage aa tester">
</canvas>
<div class="scene-label" style="left: 23.3%">
<span class="label-kicker">Parent state 1</span>
<strong>AA</strong>
<span class="visible-trait">moon-teal leaves</span>
</div>
<div class="scene-label tester" style="left: 36%">
<span class="label-kicker">Tester</span>
<strong>aa</strong>
<span class="visible-trait">lilac leaves</span>
</div>
<div class="scene-label" style="left: 64%">
<span class="label-kicker">Parent state 2</span>
<strong>Aa</strong>
<span class="visible-trait">moon-teal leaves</span>
</div>
<div class="scene-label tester" style="left: 76.7%">
<span class="label-kicker">Tester</span>
<strong>aa</strong>
<span class="visible-trait">lilac leaves</span>
</div>
<div class="scene-caption">Same parent phenotype in both states — only the allele pair differs</div>
</div>
</div>
<div class="legend" aria-label="Visualization legend">
<span class="legend-item"><span class="legend-swatch teal"></span>Moon-teal visible foliage</span>
<span class="legend-item"><span class="legend-swatch lilac"></span>Lilac visible foliage</span>
<span class="legend-item"><span class="legend-swatch genotype"></span>Letter tokens show genotype</span>
<span class="legend-item">Phenotype is shown separately from genotype</span>
</div>
<div class="check-panel" id="check-panel" data-pass="true" aria-live="polite">
<span class="status-icon" id="status-icon" aria-hidden="true">✓</span>
<strong id="check-title">Checking the actual DOM token rows…</strong>
<span id="check-detail">Both parent states are checked separately.</span>
</div>
</section>
<section class="tray-grid" aria-label="Offspring token trays">
<article class="tray" data-parent-state="AA">
<div class="tray-head">
<div>
<span class="state-pill">State 1 · AA parent</span>
<h2>AA parent paired with aa tester</h2>
</div>
<div class="equation" aria-label="AA crossed with aa">
<span class="parent-token">AA</span>
<span>×</span>
<span class="tester-token">aa</span>
</div>
</div>
<div class="rule-summary">
<strong>AA × aa → all Aa</strong>
<span>4 of 4 equally likely outcomes are Aa</span>
</div>
<div class="outcome-line">
<div class="line-label">Genotype tokens <small>letters only</small></div>
<div class="token-grid" data-role="genotypes" data-state="AA">
<span class="genotype-token" data-genotype="Aa" aria-label="Aa genotype, 25 percent chance">Aa</span>
<span class="genotype-token" data-genotype="Aa" aria-label="Aa genotype, 25 percent chance">Aa</span>
<span class="genotype-token" data-genotype="Aa" aria-label="Aa genotype, 25 percent chance">Aa</span>
<span class="genotype-token" data-genotype="Aa" aria-label="Aa genotype, 25 percent chance">Aa</span>
</div>
</div>
<div class="outcome-line">
<div class="line-label">Visible phenotype <small>separate row</small></div>
<div class="phenotype-grid" data-role="phenotypes" data-state="AA">
<span class="phenotype-chip dominant" data-phenotype="moon-teal">
<svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M20.7 3.3C13.1 3.4 7 5.2 4.3 9.1c-2.1 3-1.3 6.3.7 8.1 1.9 1.7 5 1.8 7.2.3 3.2-2.2 4.7-7.2 5.8-11.7.2-.8-.1-2.2-.5-2.5-.2-.1-.4-.1-.6 0Zm-9 12.6c2-3.4 4.7-6.2 8.1-8.4-3.8 1.8-6.7 4.4-8.9 7.7-.2-.2-.3-.4-.2-.6.1-.4.5-.8 1-1.3Z"/></svg>
<span>Moon-teal leaves</span>
</span>
<span class="phenotype-chip dominant" data-phenotype="moon-teal">
<svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M20.7 3.3C13.1 3.4 7 5.2 4.3 9.1c-2.1 3-1.3 6.3.7 8.1 1.9 1.7 5 1.8 7.2.3 3.2-2.2 4.7-7.2 5.8-11.7.2-.8-.1-2.2-.5-2.5-.2-.1-.4-.1-.6 0Zm-9 12.6c2-3.4 4.7-6.2 8.1-8.4-3.8 1.8-6.7 4.4-8.9 7.7-.2-.2-.3-.4-.2-.6.1-.4.5-.8 1-1.3Z"/></svg>
<span>Moon-teal leaves</span>
</span>
<span class="phenotype-chip dominant" data-phenotype="moon-teal">
<svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M20.7 3.3C13.1 3.4 7 5.2 4.3 9.1c-2.1 3-1.3 6.3.7 8.1 1.9 1.7 5 1.8 7.2.3 3.2-2.2 4.7-7.2 5.8-11.7.2-.8-.1-2.2-.5-2.5-.2-.1-.4-.1-.6 0Zm-9 12.6c2-3.4 4.7-6.2 8.1-8.4-3.8 1.8-6.7 4.4-8.9 7.7-.2-.2-.3-.4-.2-.6.1-.4.5-.8 1-1.3Z"/></svg>
<span>Moon-teal leaves</span>
</span>
<span class="phenotype-chip dominant" data-phenotype="moon-teal">
<svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M20.7 3.3C13.1 3.4 7 5.2 4.3 9.1c-2.1 3-1.3 6.3.7 8.1 1.9 1.7 5 1.8 7.2.3 3.2-2.2 4.7-7.2 5.8-11.7.2-.8-.1-2.2-.5-2.5-.2-.1-.4-.1-.6 0Zm-9 12.6c2-3.4 4.7-6.2 8.1-8.4-3.8 1.8-6.7 4.4-8.9 7.7-.2-.2-.3-.4-.2-.6.1-.4.5-.8 1-1.3Z"/></svg>
<span>Moon-teal leaves</span>
</span>
</div>
</div>
<p class="row-note">
Each column is one equally likely offspring outcome. The genotype token determines the
visible trait shown directly beneath it; <strong>Aa is visibly dominant in this example</strong>.
</p>
</article>
<article class="tray" data-parent-state="Aa">
<div class="tray-head">
<div>
<span class="state-pill">State 2 · Aa parent</span>
<h2>Aa parent paired with aa tester</h2>
</div>
<div class="equation" aria-label="Aa crossed with aa">
<span class="parent-token">Aa</span>
<span>×</span>
<span class="tester-token">aa</span>
</div>
</div>
<div class="rule-summary">
<strong>Aa × aa → ½ Aa + ½ aa</strong>
<span>2 of 4 outcomes are Aa; 2 of 4 are aa</span>
</div>
<div class="outcome-line">
<div class="line-label">Genotype tokens <small>letters only</small></div>
<div class="token-grid" data-role="genotypes" data-state="Aa">
<span class="genotype-token" data-genotype="Aa" aria-label="Aa genotype, 25 percent chance">Aa</span>
<span class="genotype-token" data-genotype="Aa" aria-label="Aa genotype, 25 percent chance">Aa</span>
<span class="genotype-token" data-genotype="aa" aria-label="aa genotype, 25 percent chance">aa</span>
<span class="genotype-token" data-genotype="aa" aria-label="aa genotype, 25 percent chance">aa</span>
</div>
</div>
<div class="outcome-line">
<div class="line-label">Visible phenotype <small>separate row</small></div>
<div class="phenotype-grid" data-role="phenotypes" data-state="Aa">
<span class="phenotype-chip dominant" data-phenotype="moon-teal">
<svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M20.7 3.3C13.1 3.4 7 5.2 4.3 9.1c-2.1 3-1.3 6.3.7 8.1 1.9 1.7 5 1.8 7.2.3 3.2-2.2 4.7-7.2 5.8-11.7.2-.8-.1-2.2-.5-2.5-.2-.1-.4-.1-.6 0Zm-9 12.6c2-3.4 4.7-6.2 8.1-8.4-3.8 1.8-6.7 4.4-8.9 7.7-.2-.2-.3-.4-.2-.6.1-.4.5-.8 1-1.3Z"/></svg>
<span>Moon-teal leaves</span>
</span>
<span class="phenotype-chip dominant" data-phenotype="moon-teal">
<svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M20.7 3.3C13.1 3.4 7 5.2 4.3 9.1c-2.1 3-1.3 6.3.7 8.1 1.9 1.7 5 1.8 7.2.3 3.2-2.2 4.7-7.2 5.8-11.7.2-.8-.1-2.2-.5-2.5-.2-.1-.4-.1-.6 0Zm-9 12.6c2-3.4 4.7-6.2 8.1-8.4-3.8 1.8-6.7 4.4-8.9 7.7-.2-.2-.3-.4-.2-.6.1-.4.5-.8 1-1.3Z"/></svg>
<span>Moon-teal leaves</span>
</span>
<span class="phenotype-chip recessive" data-phenotype="lilac">
<svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M20.7 3.3C13.1 3.4 7 5.2 4.3 9.1c-2.1 3-1.3 6.3.7 8.1 1.9 1.7 5 1.8 7.2.3 3.2-2.2 4.7-7.2 5.8-11.7.2-.8-.1-2.2-.5-2.5-.2-.1-.4-.1-.6 0Zm-9 12.6c2-3.4 4.7-6.2 8.1-8.4-3.8 1.8-6.7 4.4-8.9 7.7-.2-.2-.3-.4-.2-.6.1-.4.5-.8 1-1.3Z"/></svg>
<span>Lilac leaves</span>
</span>
<span class="phenotype-chip recessive" data-phenotype="lilac">
<svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M20.7 3.3C13.1 3.4 7 5.2 4.3 9.1c-2.1 3-1.3 6.3.7 8.1 1.9 1.7 5 1.8 7.2.3 3.2-2.2 4.7-7.2 5.8-11.7.2-.8-.1-2.2-.5-2.5-.2-.1-.4-.1-.6 0Zm-9 12.6c2-3.4 4.7-6.2 8.1-8.4-3.8 1.8-6.7 4.4-8.9 7.7-.2-.2-.3-.4-.2-.6.1-.4.5-.8 1-1.3Z"/></svg>
<span>Lilac leaves</span>
</span>
</div>
</div>
<p class="row-note">
The two <strong>Aa</strong> tokens are visibly moon-teal, while the two <strong>aa</strong>
tokens are visibly lilac. Genotype letters and phenotype descriptions remain in separate rows.
</p>
</article>
</section>
<p class="footer-note">
Fictional teaching model only · proportions describe equally likely model outcomes, not a claim about any real organism.
</p>
</main>
<script type="module">
import * as THREE from "https://cdnjs.cloudflare.com/ajax/libs/three.js/0.160.0/three.module.min.js";
// -------------------------------------------------------------------------
// Check the real DOM rows, rather than checking only hard-coded model data.
// -------------------------------------------------------------------------
const expectedRows = {
AA: {
genotypes: ["Aa", "Aa", "Aa", "Aa"],
phenotypes: ["moon-teal", "moon-teal", "moon-teal", "moon-teal"]
},
Aa: {
genotypes: ["Aa", "Aa", "aa", "aa"],
phenotypes: ["moon-teal", "moon-teal", "lilac", "lilac"]
}
};
const checkPanel = document.getElementById("check-panel");
const checkTitle = document.getElementById("check-title");
const checkDetail = document.getElementById("check-detail");
const statusIcon = document.getElementById("status-icon");
const verifyButton = document.getElementById("verify-button");
function valuesFor(state, role, attribute) {
return Array.from(
document.querySelectorAll(
`[data-state="${state}"][data-role="${role}"] [data-${attribute}]`
),
(element) => element.dataset[attribute]
);
}
function sameArray(actual, expected) {
return actual.length === expected.length &&
actual.every((value, index) => value === expected[index]);
}
function verifyRows() {
const stateResults = [];
for (const state of ["AA", "Aa"]) {
const actualGenotypes = valuesFor(state, "genotypes", "genotype");
const actualPhenotypes = valuesFor(state, "phenotypes", "phenotype");
const genotypePass = sameArray(actualGenotypes, expectedRows[state].genotypes);
const phenotypePass = sameArray(actualPhenotypes, expectedRows[state].phenotypes);
const aaCount = actualGenotypes.filter((value) => value === "aa").length;
const aCount = actualGenotypes.filter((value) => value === "Aa").length;
const genotypeSummary = state === "AA"
? `${aCount}/4 Aa, ${aaCount}/4 aa`
: `${aCount}/4 Aa, ${aaCount}/4 aa`;
stateResults.push({
state,
genotypePass,
phenotypePass,
genotypeSummary
});
}
const allPass = stateResults.every(
(result) => result.genotypePass && result.phenotypePass
);
checkPanel.dataset.pass = String(allPass);
statusIcon.textContent = allPass ? "✓" : "×";
checkTitle.textContent = allPass
? "PASS — actual genotype and phenotype rows match both states"
: "CHECK FAILED — an actual token row does not match the model";
checkDetail.textContent = stateResults.map((result) => {
const genotypeStatus = result.genotypePass ? "PASS" : "FAIL";
const phenotypeStatus = result.phenotypePass ? "PASS" : "FAIL";
return `${result.state}: genotype ${genotypeStatus} (${result.genotypeSummary}); phenotype ${phenotypeStatus}`;
}).join(" | ");
return allPass;
}
verifyButton.addEventListener("click", () => {
verifyRows();
verifyButton.textContent = "Rows verified ✓";
window.setTimeout(() => {
verifyButton.textContent = "Verify actual token rows";
}, 1400);
});
verifyRows();
// -------------------------------------------------------------------------
// Procedural Three.js scene. Only the Three.js core module is used.
// -------------------------------------------------------------------------
const canvas = document.getElementById("three-canvas");
const stage = document.getElementById("stage");
let renderer = null;
try {
renderer = new THREE.WebGLRenderer({
canvas,
antialias: true,
alpha: true,
powerPreference: "high-performance"
});
renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));
renderer.setClearColor(0x000000, 0);
renderer.outputColorSpace = THREE.SRGBColorSpace;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.08;
} catch (error) {
console.error("Three.js could not initialize:", error);
}
if (renderer) {
const scene = new THREE.Scene();
const camera = new THREE.OrthographicCamera(-7.7, 7.7, 2.8, -2.8, 0.1, 100);
camera.position.set(0, 1.65, 12);
camera.lookAt(0, 1.65, 0);
const hemisphere = new THREE.HemisphereLight(0xc9efff, 0x18202b, 2.3);
scene.add(hemisphere);
const keyLight = new THREE.DirectionalLight(0xfff2d4, 3.1);
keyLight.position.set(-4, 7, 8);
scene.add(keyLight);
const rimLight = new THREE.DirectionalLight(0x6ee7ff, 1.65);
rimLight.position.set(6, 4, -5);
scene.add(rimLight);
const potMaterial = new THREE.MeshStandardMaterial({
color: 0xd8755d,
roughness: 0.66,
metalness: 0.02
});
const potBandMaterial = new THREE.MeshStandardMaterial({
color: 0xf0aa79,
roughness: 0.7,
metalness: 0
});
const soilMaterial = new THREE.MeshStandardMaterial({
color: 0x392820,
roughness: 1
});
const stemMaterial = new THREE.MeshStandardMaterial({
color: 0x28785f,
roughness: 0.72
});
const veinMaterial = new THREE.MeshStandardMaterial({
color: 0xa7f2d6,
roughness: 0.75
});
const bloomCenterMaterial = new THREE.MeshStandardMaterial({
color: 0xffc95e,
roughness: 0.5
});
const leafGeometry = new THREE.SphereGeometry(1, 30, 20);
const bloomPetalGeometry = new THREE.SphereGeometry(1, 24, 16);
const bloomCenterGeometry = new THREE.SphereGeometry(0.14, 24, 16);
function cylinderBetween(start, end, radius, material, radialSegments = 18) {
const direction = new THREE.Vector3().subVectors(end, start);
const length = direction.length();
const geometry = new THREE.CylinderGeometry(radius, radius, length, radialSegments);
const mesh = new THREE.Mesh(geometry, material);
mesh.position.copy(start).add(end).multiplyScalar(0.5);
mesh.quaternion.setFromUnitVectors(
new THREE.Vector3(0, 1, 0),
direction.normalize()
);
return mesh;
}
function makePot() {
const pot = new THREE.Group();
const body = new THREE.Mesh(
new THREE.CylinderGeometry(0.53, 0.40, 0.72, 44),
potMaterial
);
body.position.y = 0.37;
pot.add(body);
const band = new THREE.Mesh(
new THREE.TorusGeometry(0.447, 0.025, 12, 48),
potBandMaterial
);
band.rotation.x = Math.PI / 2;
band.position.y = 0.49;
pot.add(band);
const rim = new THREE.Mesh(
new THREE.TorusGeometry(0.50, 0.060, 16, 52),
potMaterial
);
rim.rotation.x = Math.PI / 2;
rim.position.y = 0.75;
pot.add(rim);
const soil = new THREE.Mesh(
new THREE.CylinderGeometry(0.435, 0.435, 0.035, 44),
soilMaterial
);
soil.position.y = 0.785;
pot.add(soil);
return pot;
}
function makePlant(leafColor, bloomColor) {
const plant = new THREE.Group();
plant.add(makePot());
const leafMaterial = new THREE.MeshStandardMaterial({
color: leafColor,
roughness: 0.48,
metalness: 0.01
});
const bloomMaterial = new THREE.MeshStandardMaterial({
color: bloomColor,
roughness: 0.46,
metalness: 0
});
plant.add(cylinderBetween(
new THREE.Vector3(0, 0.79, 0),
new THREE.Vector3(0, 2.30, 0),
0.052,
stemMaterial,
20
));
const branchData = [
{ start: [0, 1.18, 0], end: [-0.34, 1.42, 0.02], leaf: [-0.39, 1.46, 0.03], rz: 0.48 },
{ start: [0, 1.40, 0], end: [0.38, 1.67, -0.02], leaf: [0.44, 1.71, -0.03], rz: -0.52 },
{ start: [0, 1.62, 0], end: [-0.38, 1.91, 0.03], leaf: [-0.43, 1.95, 0.04], rz: 0.56 },
{ start: [0, 1.82, 0], end: [0.31, 2.08, -0.03], leaf: [0.36, 2.11, -0.04], rz: -0.54 }
];
for (const branch of branchData) {
const start = new THREE.Vector3(...branch.start);
const end = new THREE.Vector3(...branch.end);
plant.add(cylinderBetween(start, end, 0.031, stemMaterial, 14));
const leaf = new THREE.Mesh(leafGeometry, leafMaterial);
leaf.position.set(...branch.leaf);
leaf.scale.set(0.39, 0.125, 0.205);
leaf.rotation.z = branch.rz;
leaf.rotation.y = branch.leaf[0] < 0 ? -0.18 : 0.18;
plant.add(leaf);
const vein = cylinderBetween(
new THREE.Vector3(branch.leaf[0] - Math.sign(branch.leaf[0]) * 0.19, branch.leaf[1], branch.leaf[2] + 0.11),
new THREE.Vector3(branch.leaf[0] + Math.sign(branch.leaf[0]) * 0.17, branch.leaf[1] + 0.035, branch.leaf[2] + 0.11),
0.012,
veinMaterial,
10
);
vein.scale.x = 0.7;
plant.add(vein);
}
const topLeaf = new THREE.Mesh(leafGeometry, leafMaterial);
topLeaf.position.set(0.02, 2.13, 0.08);
topLeaf.scale.set(0.32, 0.11, 0.18);
topLeaf.rotation.z = -0.10;
topLeaf.rotation.y = 0.35;
plant.add(topLeaf);
const flower = new THREE.Group();
flower.position.set(0, 2.43, 0);
for (let index = 0; index < 7; index += 1) {
const angle = (index / 7) * Math.PI * 2;
const petal = new THREE.Mesh(bloomPetalGeometry, bloomMaterial);
petal.position.set(Math.sin(angle) * 0.24, 0, Math.cos(angle) * 0.24);
petal.scale.set(0.16, 0.075, 0.30);
petal.rotation.y = angle;
flower.add(petal);
}
const center = new THREE.Mesh(bloomCenterGeometry, bloomCenterMaterial);
center.position.y = 0.045;
flower.add(center);
plant.add(flower);
plant.userData.flower = flower;
return plant;
}
function addGroundRing(x, radius, color, opacity) {
const ring = new THREE.Mesh(
new THREE.RingGeometry(radius * 0.82, radius, 64),
new THREE.MeshBasicMaterial({
color,
transparent: true,
opacity,
side: THREE.DoubleSide,
depthWrite: false
})
);
ring.rotation.x = -Math.PI / 2;
ring.position.set(x, -0.015, 0);
scene.add(ring);
}
function addPairLink(parentX, testerX) {
const curve = new THREE.QuadraticBezierCurve3(
new THREE.Vector3(parentX, 0.92, -0.2),
new THREE.Vector3((parentX + testerX) / 2, 1.65, -0.2),
new THREE.Vector3(testerX, 0.92, -0.2)
);
const geometry = new THREE.BufferGeometry().setFromPoints(curve.getPoints(48));
const material = new THREE.LineDashedMaterial({
color: 0x8db6c8,
transparent: true,
opacity: 0.31,
dashSize: 0.12,
gapSize: 0.09
});
const line = new THREE.Line(geometry, material);
line.computeLineDistances();
scene.add(line);
}
// Both parents use exactly the same dimensions, colors, and phenotype.
const dominantLeaf = 0x36d8c1;
const dominantBloom = 0xffd66e;
const recessiveLeaf = 0xb78ae7;
const recessiveBloom = 0xf08fbd;
const parentPositions = [-4.10, 2.15];
const testerOffsets = [1.95, 1.95];
const parentPlants = [];
for (let index = 0; index < parentPositions.length; index += 1) {
const parentX = parentPositions[index];
const testerX = parentX + testerOffsets[index];
const parent = makePlant(dominantLeaf, dominantBloom);
parent.position.x = parentX;
scene.add(parent);
parentPlants.push(parent);
const tester = makePlant(recessiveLeaf, recessiveBloom);
tester.position.x = testerX;
tester.position.y = 0.035;
tester.scale.setScalar(0.72);
scene.add(tester);
addGroundRing(parentX, 0.87, 0x43ddc4, 0.17);
addGroundRing(testerX, 0.66, 0xc49bf3, 0.13);
addPairLink(parentX, testerX);
}
function resize() {
if (!renderer) return;
const width = Math.max(1, stage.clientWidth);
const height = Math.max(1, stage.clientHeight);
const aspect = width / height;
const viewHeight = Math.max(5.65, 15.4 / aspect);
const viewWidth = viewHeight * aspect;
camera.left = -viewWidth / 2;
camera.right = viewWidth / 2;
camera.top = viewHeight / 2 + 1.65;
camera.bottom = -viewHeight / 2 + 1.65;
camera.updateProjectionMatrix();
renderer.setSize(width, height, false);
}
const resizeObserver = new ResizeObserver(resize);
resizeObserver.observe(stage);
resize();
renderer.setAnimationLoop((time) => {
const seconds = time * 0.001;
const pulse = 1 + Math.sin(seconds * 1.55) * 0.022;
// Both parent blooms use the same phase, so the AA and Aa parents never
// acquire different shapes, sizes, colors, or visible states.
for (const parent of parentPlants) {
parent.userData.flower.scale.setScalar(pulse);
}
renderer.render(scene, camera);
});
}
</script>
</body>
</html>
```