Pegamento Race Track
:root {
--pg-purple: #5E2684;
--pg-blue: #04A1C4;
--pg-dark: #070C31;
--pg-orange: #FC935A;
--pg-green: #00A080;
--pg-red: #DB474B;
--pg-white: #FFFFFF;
--pg-line: rgba(255,255,255,0.16);
--shadow-lg: 0 18px 40px rgba(7, 12, 49, 0.28);
--shadow-md: 0 10px 24px rgba(7, 12, 49, 0.18);
--radius-xl: 28px;
--radius-lg: 20px;
--radius-md: 14px;
}
* { box-sizing: border-box; }
body {
margin: 0;
font-family: "Open Sans", Arial, sans-serif;
background:
radial-gradient(circle at top left, rgba(4,161,196,0.12), transparent 22%),
radial-gradient(circle at top right, rgba(94,38,132,0.18), transparent 28%),
linear-gradient(180deg, #09113f 0%, var(--pg-dark) 100%);
color: var(--pg-white);
min-height: 100vh;
}
.page {
max-width: 1380px;
margin: 0 auto;
padding: 32px 20px 48px;
}
.hero {
position: relative;
overflow: hidden;
border: 1px solid rgba(255,255,255,0.14);
border-radius: var(--radius-xl);
padding: 28px 28px 24px;
background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
box-shadow: var(--shadow-lg);
backdrop-filter: blur(10px);
margin-bottom: 22px;
}
.hero::before,
.hero::after {
content: "";
position: absolute;
border-radius: 999px;
filter: blur(8px);
pointer-events: none;
}
.hero::before {
width: 240px;
height: 240px;
right: -60px;
top: -60px;
background: radial-gradient(circle, rgba(4,161,196,0.28), rgba(4,161,196,0));
}
.hero::after {
width: 280px;
height: 280px;
left: -80px;
bottom: -120px;
background: radial-gradient(circle, rgba(94,38,132,0.28), rgba(94,38,132,0));
}
.eyebrow {
display: inline-flex;
align-items: center;
gap: 10px;
margin-bottom: 12px;
color: #bfeef7;
font-size: 13px;
font-weight: 700;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.eyebrow-dot {
width: 12px;
height: 12px;
border-radius: 50%;
background: linear-gradient(135deg, var(--pg-blue), var(--pg-purple));
box-shadow: 0 0 0 6px rgba(4,161,196,0.12);
}
h1, h2, h3 {
font-family: Torus, "Open Sans", Arial, sans-serif;
letter-spacing: 0.01em;
}
h1 {
margin: 0 0 10px;
font-size: clamp(32px, 5vw, 54px);
line-height: 1.03;
max-width: 820px;
}
.hero p {
margin: 0;
max-width: 840px;
line-height: 1.65;
color: rgba(255,255,255,0.86);
font-size: 16px;
}
.controls {
display: grid;
grid-template-columns: 1fr auto auto;
gap: 12px;
margin-bottom: 18px;
}
.control-card {
background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
border: 1px solid rgba(255,255,255,0.12);
border-radius: var(--radius-lg);
padding: 16px;
box-shadow: var(--shadow-md);
}
.field {
display: flex;
flex-direction: column;
gap: 8px;
}
label {
font-size: 14px;
font-weight: 700;
color: #d6f6fb;
}
input {
width: 100%;
height: 54px;
border: 1px solid rgba(255,255,255,0.18);
border-radius: var(--radius-md);
background: rgba(255,255,255,0.96);
color: var(--pg-dark);
padding: 0 16px;
font-size: 16px;
font-weight: 600;
outline: none;
transition: 0.2s ease;
}
input:focus {
border-color: var(--pg-blue);
box-shadow: 0 0 0 4px rgba(4,161,196,0.18);
}
button {
height: 86px;
min-width: 150px;
border: 0;
border-radius: var(--radius-lg);
padding: 0 20px;
font-size: 15px;
font-weight: 800;
cursor: pointer;
transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
box-shadow: var(--shadow-md);
}
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }
.btn-primary {
color: var(--pg-white);
background: linear-gradient(135deg, var(--pg-blue), var(--pg-purple));
}
.btn-reset {
color: var(--pg-white);
background: linear-gradient(135deg, var(--pg-orange), #e46f36);
}
.statusbar {
display: flex;
justify-content: space-between;
gap: 16px;
align-items: center;
margin-bottom: 18px;
padding: 14px 16px;
border-radius: var(--radius-lg);
background: rgba(255,255,255,0.08);
border: 1px solid rgba(255,255,255,0.12);
}
.status-text {
color: #e4f9fd;
font-size: 14px;
font-weight: 600;
}
.chip {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 8px 12px;
border-radius: 999px;
background: rgba(255,255,255,0.1);
font-size: 13px;
font-weight: 700;
color: #dffaff;
white-space: nowrap;
}
.board {
border-radius: var(--radius-xl);
border: 1px solid rgba(255,255,255,0.12);
background:
linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04)),
linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0));
box-shadow: var(--shadow-lg);
overflow: hidden;
}
.board-top {
display: grid;
grid-template-columns: 120px repeat(10, minmax(72px, 1fr));
align-items: stretch;
background: rgba(255,255,255,0.04);
border-bottom: 1px solid rgba(255,255,255,0.12);
}
.board-top .title-cell,
.step-cell {
min-height: 66px;
display: flex;
align-items: center;
justify-content: center;
font-weight: 800;
font-size: 15px;
color: #dbf8fc;
position: relative;
}
.title-cell {
justify-content: flex-start;
padding-left: 18px;
color: #a9edf7;
}
.step-cell {
border-left: 1px solid rgba(255,255,255,0.08);
}
.step-cell:last-child {
background:
linear-gradient(45deg, rgba(255,255,255,0.95) 25%, rgba(7,12,49,0.95) 25%, rgba(7,12,49,0.95) 50%, rgba(255,255,255,0.95) 50%, rgba(255,255,255,0.95) 75%, rgba(7,12,49,0.95) 75%, rgba(7,12,49,0.95) 100%);
background-size: 24px 24px;
color: var(--pg-dark);
}
.lanes {
display: grid;
gap: 0;
}
.lane {
display: grid;
grid-template-columns: 120px repeat(10, minmax(72px, 1fr));
min-height: 82px;
border-bottom: 1px solid rgba(255,255,255,0.08);
background: linear-gradient(90deg, rgba(255,255,255,0.015), rgba(255,255,255,0.035));
}
.lane:nth-child(even) {
background: linear-gradient(90deg, rgba(255,255,255,0.03), rgba(255,255,255,0.055));
}
.lane-name {
position: relative;
z-index: 2;
display: flex;
flex-direction: column;
justify-content: center;
padding: 10px 16px;
border-right: 1px solid rgba(255,255,255,0.1);
background: linear-gradient(90deg, rgba(4,161,196,0.08), rgba(94,38,132,0.08));
}
.lane-name strong {
font-size: 15px;
color: var(--pg-white);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.lane-name span {
font-size: 12px;
color: #bdeefa;
margin-top: 3px;
}
.track-cell {
border-right: 1px solid rgba(255,255,255,0.08);
position: relative;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
.track-cell::after {
content: "";
position: absolute;
width: 46px;
height: 6px;
border-radius: 999px;
background: rgba(255,255,255,0.12);
}
.track-cell.active {
background: linear-gradient(180deg, rgba(4,161,196,0.12), rgba(94,38,132,0.12));
}
.track-cell.finish {
background:
linear-gradient(45deg, rgba(255,255,255,0.9) 25%, rgba(7,12,49,0.95) 25%, rgba(7,12,49,0.95) 50%, rgba(255,255,255,0.9) 50%, rgba(255,255,255,0.9) 75%, rgba(7,12,49,0.95) 75%, rgba(7,12,49,0.95) 100%);
background-size: 24px 24px;
}
.car {
position: relative;
z-index: 2;
display: inline-flex;
align-items: center;
justify-content: center;
width: 58px;
height: 34px;
border-radius: 12px 18px 10px 10px;
background: linear-gradient(135deg, var(--pg-blue), var(--pg-purple));
box-shadow: 0 10px 16px rgba(0,0,0,0.24);
transform: translateY(-2px);
}
.car::before {
content: "";
position: absolute;
inset: 7px 12px auto 14px;
height: 10px;
border-radius: 8px;
background: rgba(255,255,255,0.84);
}
.car::after {
content: "";
position: absolute;
left: 8px;
bottom: -6px;
width: 14px;
height: 14px;
border-radius: 50%;
background: var(--pg-dark);
box-shadow: 28px 0 0 var(--pg-dark);
}
.car-number {
position: relative;
z-index: 3;
font-size: 11px;
font-weight: 800;
color: #ffffff;
margin-top: -2px;
}
.empty-state {
padding: 44px 20px;
text-align: center;
color: #d8f7fc;
font-weight: 600;
}
.leaderboard {
margin-top: 18px;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 12px;
}
.leader-card {
border-radius: 18px;
padding: 14px 16px;
background: linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.04));
border: 1px solid rgba(255,255,255,0.12);
}
.leader-card strong {
display: block;
font-size: 15px;
margin-bottom: 4px;
}
.leader-card span {
color: #c9f5fb;
font-size: 13px;
}
@media (max-width: 980px) {
.controls {
grid-template-columns: 1fr;
}
button {
height: 56px;
}
.board {
overflow-x: auto;
}
.board-top,
.lane {
min-width: 980px;
}
}
@media (max-width: 680px) {
.statusbar {
flex-direction: column;
align-items: flex-start;
}
}
Pegamento racing experience
Add a name and your own race car appears on the track. Enter the exact same name again, and that cart moves up one step, from 1 to 10. Step 10 is the finish line.
Enter name
Add / one step further
Reset race
No participants yet. Add the first racer.
0 racers on the track
const MAX_POSITION = 10;
const racers = new Map();
const nameInput = document.getElementById('nameInput');
const addBtn = document.getElementById('addBtn');
const resetBtn = document.getElementById('resetBtn');
const status = document.getElementById('status');
const racerCount = document.getElementById('racerCount');
const boardTop = document.getElementById('boardTop');
const lanes = document.getElementById('lanes');
const leaderboard = document.getElementById('leaderboard');
function normalizeName(value) {
return value.trim().replace(/\s+/g, ' ');
}
function getKey(name) {
return name.toLocaleLowerCase('nl-NL');
}
function escapeHtml(text) {
return text
.replace(/&/g, '&')
.replace(//g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''');
}
function buildHeader() {
const parts = ['
Racebaan
'];
for (let i = 1; i <= MAX_POSITION; i++) {
parts.push(`
${i}
`);
}
boardTop.innerHTML = parts.join('');
}
function addOrAdvanceRacer() {
const rawName = normalizeName(nameInput.value);
if (!rawName) {
status.textContent = 'Voer eerst een naam in om een racewagen te plaatsen.';
nameInput.focus();
return;
}
const key = getKey(rawName);
if (!racers.has(key)) {
racers.set(key, { name: rawName, position: 1 });
status.textContent = `${rawName} is toegevoegd op stap 1.`;
} else {
const racer = racers.get(key);
if (racer.position b.position - a.position || a.name.localeCompare(b.name, 'nl-NL'));
}
function renderLanes() {
lanes.innerHTML = '';
if (racers.size === 0) {
lanes.innerHTML = '
Nog geen racers op de baan. Voeg hierboven een naam toe.
';
return;
}
const sorted = getSortedRacers();
sorted.forEach((racer, index) => {
const row = document.createElement('div');
row.className = 'lane';
let cells = `
${escapeHtml(racer.name)}
Baan ${index + 1} · positie ${racer.position}/10
`;
for (let step = 1; step <= MAX_POSITION; step++) {
const classes = ['track-cell'];
if (step === racer.position) classes.push('active');
if (step === MAX_POSITION) classes.push('finish');
cells += `
`;
if (step === racer.position) {
cells += `
${step}
`;
}
cells += `
`;
}
row.innerHTML = cells;
lanes.appendChild(row);
});
}
function renderLeaderboard() {
leaderboard.innerHTML = '';
if (racers.size === 0) return;
const sorted = getSortedRacers();
sorted.forEach((racer, index) => {
const card = document.createElement('div');
card.className = 'leader-card';
const remaining = MAX_POSITION - racer.position;
card.innerHTML = `
#${index + 1} ${escapeHtml(racer.name)}
${remaining === 0 ? 'Finish bereikt' : `Nog ${remaining} stap${remaining === 1 ? '' : 'pen'} tot de finish`} · ${racer.position}/10
`;
leaderboard.appendChild(card);
});
}
function render() {
racerCount.textContent = racers.size;
renderLanes();
renderLeaderboard();
}
addBtn.addEventListener('click', addOrAdvanceRacer);
resetBtn.addEventListener('click', resetRace);
nameInput.addEventListener('keydown', (event) => {
if (event.key === 'Enter') addOrAdvanceRacer();
});
buildHeader();
render();