Add initial styles for dark theme and layout structure in styles.css
This commit is contained in:
parent
25e38986db
commit
7b5fdad378
3 changed files with 1864 additions and 0 deletions
91
index.html
Normal file
91
index.html
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Emergent Civilization Simulation</title>
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<main class="app">
|
||||
<aside class="sidebar" aria-label="Simulation controls">
|
||||
<div class="brand">
|
||||
<h1>Civil Emergence Lab</h1>
|
||||
<p>Local rules, genealogical cultures, settlement pressure, migration, and collapse.</p>
|
||||
</div>
|
||||
|
||||
<section class="panel controls">
|
||||
<div class="row">
|
||||
<button id="toggleRun" class="primary" type="button">Pause</button>
|
||||
<button id="stepOnce" type="button">Step</button>
|
||||
<button id="resetWorld" type="button">Reset</button>
|
||||
</div>
|
||||
<div class="row">
|
||||
<button id="saveWorld" type="button">Save</button>
|
||||
<button id="loadWorld" type="button">Load</button>
|
||||
<button id="clearSave" type="button">Clear</button>
|
||||
</div>
|
||||
|
||||
<label>
|
||||
Speed
|
||||
<input id="speed" type="range" min="1" max="12" value="5">
|
||||
</label>
|
||||
|
||||
<label>
|
||||
Initial groups
|
||||
<input id="agentCount" type="range" min="500" max="20000" step="500" value="5000">
|
||||
</label>
|
||||
|
||||
<label>
|
||||
World scale
|
||||
<select id="worldSize">
|
||||
<option value="128">128 x 128</option>
|
||||
<option value="160" selected>160 x 160</option>
|
||||
<option value="220">220 x 220</option>
|
||||
<option value="280">280 x 280</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
View
|
||||
<select id="viewMode">
|
||||
<option value="terrain">Terrain</option>
|
||||
<option value="resources">Resources</option>
|
||||
<option value="ethnicity">Ethnicity</option>
|
||||
<option value="pheromone">Trade trails</option>
|
||||
<option value="pressure">Population pressure</option>
|
||||
<option value="cities">Cities</option>
|
||||
</select>
|
||||
</label>
|
||||
</section>
|
||||
|
||||
<section class="panel stats" aria-live="polite">
|
||||
<dl>
|
||||
<div><dt>Year</dt><dd id="year">0</dd></div>
|
||||
<div><dt>Total population</dt><dd id="population">0</dd></div>
|
||||
<div><dt>Active groups</dt><dd id="activeGroups">0</dd></div>
|
||||
<div><dt>Urban population</dt><dd id="urbanPopulation">0</dd></div>
|
||||
<div><dt>Ethnicities</dt><dd id="ethnicities">0</dd></div>
|
||||
<div><dt>Cities</dt><dd id="cities">0</dd></div>
|
||||
<div><dt>Trade routes</dt><dd id="routes">0</dd></div>
|
||||
<div><dt>Collapse deaths</dt><dd id="deaths">0</dd></div>
|
||||
<div><dt>Frame cost</dt><dd id="frameCost">0ms</dd></div>
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
<section class="panel ledger">
|
||||
<h2>Dominant lineages</h2>
|
||||
<ol id="ethnicityList"></ol>
|
||||
</section>
|
||||
</aside>
|
||||
|
||||
<section class="sim">
|
||||
<canvas id="world" width="960" height="960" aria-label="Civilization simulation canvas"></canvas>
|
||||
<div class="legend" id="legend"></div>
|
||||
<div class="tooltip" id="tooltip" hidden></div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
288
styles.css
Normal file
288
styles.css
Normal file
|
|
@ -0,0 +1,288 @@
|
|||
:root {
|
||||
color-scheme: dark;
|
||||
--bg: #111315;
|
||||
--panel: #1b1f22;
|
||||
--panel-2: #22282c;
|
||||
--line: #31383d;
|
||||
--text: #eef1ed;
|
||||
--muted: #a8b1aa;
|
||||
--accent: #69b578;
|
||||
--accent-2: #e3b341;
|
||||
--danger: #d35f54;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||
}
|
||||
|
||||
button,
|
||||
input,
|
||||
select {
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
.app {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
padding: 14px;
|
||||
overflow: auto;
|
||||
border-right: 1px solid var(--line);
|
||||
background: #16191b;
|
||||
}
|
||||
|
||||
.brand h1 {
|
||||
margin: 0 0 6px;
|
||||
font-size: 24px;
|
||||
line-height: 1.05;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
|
||||
.brand p {
|
||||
margin: 0;
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.panel {
|
||||
padding: 12px;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
background: var(--panel);
|
||||
}
|
||||
|
||||
.row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr 1fr;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
button,
|
||||
select {
|
||||
min-height: 34px;
|
||||
border: 1px solid #3d464b;
|
||||
border-radius: 6px;
|
||||
background: var(--panel-2);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
button {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover,
|
||||
select:hover {
|
||||
border-color: #59656b;
|
||||
}
|
||||
|
||||
button.primary {
|
||||
background: #254b30;
|
||||
border-color: #3d794b;
|
||||
}
|
||||
|
||||
.controls label {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
margin-top: 11px;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
input[type="range"] {
|
||||
width: 100%;
|
||||
accent-color: var(--accent);
|
||||
}
|
||||
|
||||
select {
|
||||
width: 100%;
|
||||
padding: 0 9px;
|
||||
}
|
||||
|
||||
.stats dl {
|
||||
display: grid;
|
||||
gap: 7px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.stats div {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
min-height: 22px;
|
||||
}
|
||||
|
||||
.stats dt {
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.stats dd {
|
||||
margin: 0;
|
||||
font-variant-numeric: tabular-nums;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.ledger {
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.ledger h2 {
|
||||
margin: 0 0 10px;
|
||||
font-size: 14px;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
|
||||
.ledger ol {
|
||||
display: grid;
|
||||
gap: 7px;
|
||||
max-height: 260px;
|
||||
margin: 0;
|
||||
padding-left: 22px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.ledger li {
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.lineage-chip {
|
||||
display: inline-block;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
margin-right: 7px;
|
||||
border-radius: 2px;
|
||||
vertical-align: -1px;
|
||||
}
|
||||
|
||||
.sim {
|
||||
position: relative;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
padding: 16px;
|
||||
background: #101214;
|
||||
}
|
||||
|
||||
canvas {
|
||||
display: block;
|
||||
width: min(calc(100vh - 32px), calc(100vw - 380px));
|
||||
height: min(calc(100vh - 32px), calc(100vw - 380px));
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
border: 1px solid #293035;
|
||||
background: #0b0d0f;
|
||||
image-rendering: pixelated;
|
||||
}
|
||||
|
||||
.legend {
|
||||
position: absolute;
|
||||
right: 24px;
|
||||
bottom: 20px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
max-width: min(560px, calc(100% - 48px));
|
||||
padding: 8px 10px;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
background: rgba(20, 23, 25, 0.92);
|
||||
color: var(--muted);
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.legend span {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.legend i {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
position: absolute;
|
||||
z-index: 3;
|
||||
min-width: 180px;
|
||||
max-width: 260px;
|
||||
padding: 8px 10px;
|
||||
border: 1px solid #435057;
|
||||
border-radius: 6px;
|
||||
background: rgba(15, 18, 20, 0.96);
|
||||
color: var(--text);
|
||||
font-size: 11px;
|
||||
line-height: 1.35;
|
||||
pointer-events: none;
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
|
||||
}
|
||||
|
||||
.tooltip strong {
|
||||
display: block;
|
||||
margin-bottom: 4px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tooltip span {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 14px;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
@media (max-width: 820px) {
|
||||
body {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.app {
|
||||
grid-template-columns: 1fr;
|
||||
height: auto;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
border-right: 0;
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
|
||||
.sim {
|
||||
min-height: 70vh;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
canvas {
|
||||
width: min(calc(100vw - 20px), 92vh);
|
||||
height: min(calc(100vw - 20px), 92vh);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue