Prompt/Code
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>SaaS Runway Calculator</title> <style> :root { --primary: #635bff; --text-dark: #0a2540; --text-light: #425466; --bg: #f6f9fc; --white: #ffffff; --danger: #e53e3e; --success: #38a169; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
background-color: var(--bg);
color: var(--text-dark);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
padding: 20px;
}
.container {
background: var(--white);
padding: 40px;
border-radius: 16px;
box-shadow: 0 15px 35px rgba(50, 50, 93, 0.1), 0 5px 15px rgba(0, 0, 0, 0.07);
width: 100%;
max-width: 500px;
}
h1 {
font-size: 24px;
font-weight: 700;
margin-bottom: 8px;
color: var(--text-dark);
}
p.subtitle {
color: var(--text-light);
margin-bottom: 32px;
font-size: 15px;
}
.input-group {
margin-bottom: 20px;
}
label {
display: block;
font-size: 14px;
font-weight: 600;
color: var(--text-dark);
margin-bottom: 8px;
}
input {
width: 100%;
padding: 12px;
border: 1px solid #e6ebf1;
border-radius: 8px;
font-size: 16px;
transition: all 0.2s;
background: #f6f9fc;
box-sizing: border-box;
}
input:focus {
outline: none;
border-color: var(--primary);
background: var(--white);
box-shadow: 0 0 0 4px rgba(99, 91, 255, 0.15);
}
.result-box {
background: var(--text-dark);
color: var(--white);
padding: 24px;
border-radius: 12px;
margin-top: 32px;
text-align: center;
}
.runway-number {
font-size: 48px;
font-weight: 800;
line-height: 1;
margin: 10px 0;
}
.runway-number.danger { color: #fc8181; }
.runway-number.safe { color: #68d391; }
.label-small {
text-transform: uppercase;
letter-spacing: 1px;
font-size: 11px;
opacity: 0.8;
font-weight: 600;
}
.chart-container {
display: flex;
align-items: flex-end;
height: 100px;
gap: 4px;
margin-top: 24px;
padding-top: 20px;
border-top: 1px solid rgba(255,255,255,0.1);
}
.bar {
flex: 1;
background: rgba(255,255,255,0.2);
border-radius: 2px 2px 0 0;
transition: height 0.3s;
}
.bar.positive { background: var(--success); }
.bar.negative { background: var(--danger); }
.cta-button {
display: block;
width: 100%;
background: var(--primary);
color: white;
border: none;
padding: 14px;
border-radius: 8px;
font-size: 16px;
font-weight: 600;
cursor: pointer;
margin-top: 20px;
transition: transform 0.1s;
}
.cta-button:hover {
transform: translateY(-1px);
box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
}
</style>
</head> <body>
<div class="container"> <h1>Startup Runway Calculator</h1> <p class="subtitle">Do you have enough cash to survive the valley of death?</p>
<div class="input-group">
<label>Cash in Bank ($)</label>
<input type="number" id="cash" value="50000" oninput="calculate()">
</div>
<div class="input-group">
<label>Monthly Revenue (MRR) ($)</label>
<input type="number" id="revenue" value="5000" oninput="calculate()">
</div>
<div class="input-group">
<label>Monthly Expenses ($)</label>
<input type="number" id="expenses" value="12000" oninput="calculate()">
</div>
<div class="input-group">
<label>Monthly Growth Rate (%)</label>
<input type="number" id="growth" value="10" oninput="calculate()">
</div>
<div class="result-box">
<div class="label-small">Estimated Runway</div>
<div class="runway-number" id="result">-- Months</div>
<div class="label-small" id="status-text">Calculating...</div>
<div class="chart-container" id="chart">
</div>
</div>
<button class="cta-button" onclick="alert('This is where you would collect their email!')">Download Full PDF Report</button>
</div>
<script> function calculate() { let cash = parseFloat(document.getElementById('cash').value) || 0; let revenue = parseFloat(document.getElementById('revenue').value) || 0; const expenses = parseFloat(document.getElementById('expenses').value) || 0; const growth = (parseFloat(document.getElementById('growth').value) || 0) / 100;
let months = 0;
let cashHistory = [];
const limit = 24; // Cap projection at 24 months
let isProfitable = false;
// Simulate 24 months
let currentCash = cash;
let currentRev = revenue;
for (let i = 0; i < limit; i++) {
let burn = expenses - currentRev;
currentCash -= burn;
cashHistory.push(currentCash);
if (burn <= 0) {
isProfitable = true;
break; // Reached profitability
}
if (currentCash <= 0) {
break; // Ran out of money
}
months++;
currentRev = currentRev * (1 + growth);
}
// Update UI
const resultEl = document.getElementById('result');
const statusEl = document.getElementById('status-text');
const chartEl = document.getElementById('chart');
// Handle Infinite/Profitable
if (isProfitable) {
resultEl.innerHTML = "∞";
resultEl.className = "runway-number safe";
statusEl.innerHTML = "Default Alive (Profitable!)";
} else if (months >= limit && currentCash > 0) {
resultEl.innerHTML = "24+";
resultEl.className = "runway-number safe";
statusEl.innerHTML = "Safe for now";
} else {
resultEl.innerHTML = months + " Months";
resultEl.className = months < 6 ? "runway-number danger" : "runway-number";
statusEl.innerHTML = months < 6 ? "Panic Mode" : "Keep Pushing";
}
// Render Chart
chartEl.innerHTML = '';
const maxVal = Math.max(...cashHistory, cash); // scale based on max cash
cashHistory.forEach(val => {
const bar = document.createElement('div');
bar.className = val > 0 ? 'bar positive' : 'bar negative';
// limit height to 100%
const height = Math.max(0, (val / maxVal) * 100);
bar.style.height = height + "%";
chartEl.appendChild(bar);
});
}
// Init
calculate();
</script>
</body> </html>