You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

779 lines
25 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>System Design Game - System Failed</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&display=swap');
/* === CSS VARIABLES === */
:root {
/* Failure Colors - Red Theme */
--color-bg-body: #1a0a0a;
--color-bg-dark: #0f0505;
--color-bg-card: #2a1010;
--color-bg-hover: #3a1515;
--color-bg-accent: #8b0000;
--color-border: #660000;
--color-border-accent: #ff4444;
--color-border-panel: #4a1515;
--color-text-primary: #ffcccc;
--color-text-muted: #cc8888;
--color-text-accent: #ff4444;
--color-text-white: #fff;
--color-text-danger: #ff0000;
--color-button: #cc0000;
--color-button-hover: #ff0000;
--color-button-disabled: #660000;
/* Normal Colors - Original Theme (for recovery) */
--color-bg-body-normal: #161b22;
--color-bg-dark-normal: #121212;
--color-bg-card-normal: #1e1e1e;
--color-bg-hover-normal: #2a2a2a;
--color-bg-accent-normal: #005f87;
--color-border-normal: #444;
--color-border-accent-normal: #00ff88;
--color-border-panel-normal: #30363d;
--color-text-primary-normal: #ccc;
--color-text-muted-normal: #888;
--color-text-accent-normal: #00ff88;
--color-text-white-normal: #fff;
--color-button-normal: #238636;
--color-button-hover-normal: #2ea043;
/* Sizes */
--radius-small: 4px;
--radius-medium: 6px;
--radius-large: 8px;
--font-family-mono: 'JetBrains Mono', monospace;
}
/* === RESET === */
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: var(--font-family-mono);
background-color: var(--color-bg-body);
color: var(--color-text-primary);
min-height: 100vh;
overflow: hidden;
background-image:
radial-gradient(circle at 20% 30%, rgba(255, 0, 0, 0.3), transparent 40%),
radial-gradient(circle at 80% 70%, rgba(139, 0, 0, 0.2), transparent 50%),
radial-gradient(circle at 50% 50%, rgba(255, 68, 68, 0.1), transparent 60%);
animation: backgroundPulse 3s ease-in-out infinite alternate;
transition: all 3s ease-in-out;
}
/* Recovery state - transitions to normal colors */
body.recovering {
background-color: var(--color-bg-body-normal);
color: var(--color-text-primary-normal);
background-image:
radial-gradient(circle at 30% 50%, rgba(0, 255, 136, 0.1), transparent 50%),
radial-gradient(circle at 70% 80%, rgba(255, 107, 53, 0.1), transparent 50%);
animation: none;
}
@keyframes backgroundPulse {
0% {
background-size: 100% 100%, 100% 100%, 100% 100%;
}
100% {
background-size: 110% 110%, 110% 110%, 110% 110%;
}
}
/* === HEADER === */
.header {
width: 100%;
background: linear-gradient(90deg, var(--color-bg-dark), var(--color-bg-accent), var(--color-bg-dark));
padding: 12px 24px;
font-weight: bold;
color: var(--color-text-danger);
border-bottom: 1px solid var(--color-border-accent);
display: flex;
align-items: center;
justify-content: space-between;
box-shadow: 0 2px 10px rgba(255, 0, 0, 0.3);
animation: headerFlicker 2s ease-in-out infinite;
transition: all 3s ease-in-out;
}
.recovering .header {
background: none;
color: var(--color-text-accent-normal);
border-bottom: 1px solid var(--color-border-normal);
box-shadow: none;
animation: none;
}
@keyframes headerFlicker {
0%, 100% { opacity: 1; }
50% { opacity: 0.8; }
}
.header-logo-container {
display: flex;
align-items: center;
gap: 12px;
}
.header-text {
font-size: 24px;
margin: 0;
text-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
transition: all 3s ease-in-out;
}
.beta-pill {
background: linear-gradient(45deg, #ff6b35, #f7931e);
color: white;
padding: 4px 8px;
border-radius: 12px;
font-size: 0.7rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.5px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
transition: all 3s ease-in-out;
}
.recovering .header-text {
text-shadow: 0 0 10px rgba(0, 255, 136, 0.8)
}
.status-indicator {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 8px 14px;
background-color: var(--color-bg-accent);
color: var(--color-text-white);
border-radius: var(--radius-medium);
font-weight: 500;
font-size: 12px;
border: 1px solid var(--color-border-accent);
animation: statusBlink 1s ease-in-out infinite;
transition: all 3s ease-in-out;
}
.recovering .status-indicator {
background-color: var(--color-bg-accent-normal);
border-color: var(--color-border-accent-normal);
animation: none;
}
@keyframes statusBlink {
0%, 50% { background-color: var(--color-bg-accent); }
51%, 100% { background-color: var(--color-button-hover); }
}
/* === MAIN FAILURE SCREEN === */
.failure-container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: calc(100vh - 80px);
padding: 40px 20px;
position: relative;
}
/* Doom-style skull/warning icon */
.failure-icon {
font-size: 120px;
color: var(--color-text-danger);
margin-bottom: 30px;
animation: skullPulse 2s ease-in-out infinite;
text-shadow:
0 0 20px rgba(255, 0, 0, 0.8),
0 0 40px rgba(255, 0, 0, 0.6),
0 0 60px rgba(255, 0, 0, 0.4);
transition: all 3s ease-in-out;
}
.recovering .failure-icon {
color: var(--color-text-accent-normal);
animation: none;
text-shadow:
0 0 20px rgba(0, 255, 136, 0.8),
0 0 40px rgba(0, 255, 136, 0.6),
0 0 60px rgba(0, 255, 136, 0.4);
}
@keyframes skullPulse {
0%, 100% {
transform: scale(1);
filter: brightness(1);
}
50% {
transform: scale(1.1);
filter: brightness(1.3);
}
}
.failure-title {
font-size: 64px;
font-weight: 700;
color: var(--color-text-danger);
margin: 0 0 20px 0;
text-align: center;
text-shadow:
0 0 10px rgba(255, 0, 0, 0.8),
0 0 20px rgba(255, 0, 0, 0.6),
0 0 30px rgba(255, 0, 0, 0.4);
animation: titleGlitch 3s ease-in-out infinite;
transition: all 3s ease-in-out;
}
.recovering .failure-title {
color: var(--color-text-accent-normal);
text-shadow:
0 0 10px rgba(0, 255, 136, 0.8),
0 0 20px rgba(0, 255, 136, 0.6),
0 0 30px rgba(0, 255, 136, 0.4);
animation: none;
}
@keyframes titleGlitch {
0%, 90%, 100% {
transform: translateX(0);
filter: hue-rotate(0deg);
}
92% {
transform: translateX(-2px);
filter: hue-rotate(90deg);
}
94% {
transform: translateX(2px);
filter: hue-rotate(-90deg);
}
96% {
transform: translateX(-1px);
filter: hue-rotate(45deg);
}
}
.failure-subtitle {
font-size: 24px;
color: var(--color-text-accent);
margin: 0 0 40px 0;
text-align: center;
opacity: 0.9;
animation: subtitleFade 2s ease-in-out infinite alternate;
transition: all 3s ease-in-out;
}
.recovering .failure-subtitle {
color: var(--color-text-muted-normal);
animation: none;
opacity: 1;
}
@keyframes subtitleFade {
0% { opacity: 0.7; }
100% { opacity: 1; }
}
/* === FAILURE DETAILS === */
.failure-details {
background: var(--color-bg-card);
border: 2px solid var(--color-border-accent);
border-radius: var(--radius-large);
padding: 30px;
margin-bottom: 40px;
max-width: 600px;
width: 100%;
box-shadow:
0 0 20px rgba(255, 0, 0, 0.3),
inset 0 0 20px rgba(255, 0, 0, 0.1);
animation: detailsPulse 4s ease-in-out infinite;
transition: all 3s ease-in-out;
}
.recovering .failure-details {
background: var(--color-bg-card-normal);
border-color: var(--color-border-accent-normal);
box-shadow:
0 0 20px rgba(0, 255, 136, 0.3),
inset 0 0 20px rgba(0, 255, 136, 0.1);
animation: none;
}
@keyframes detailsPulse {
0%, 100% {
border-color: var(--color-border-accent);
box-shadow:
0 0 20px rgba(255, 0, 0, 0.3),
inset 0 0 20px rgba(255, 0, 0, 0.1);
}
50% {
border-color: var(--color-text-danger);
box-shadow:
0 0 30px rgba(255, 0, 0, 0.5),
inset 0 0 30px rgba(255, 0, 0, 0.2);
}
}
.failure-reason {
font-size: 18px;
font-weight: 600;
color: var(--color-text-white);
margin-bottom: 20px;
text-align: center;
transition: all 3s ease-in-out;
}
.recovering .failure-reason {
color: var(--color-text-white-normal);
}
.failure-metrics {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
margin-bottom: 20px;
}
.metric-item {
background: var(--color-bg-dark);
border: 1px solid var(--color-border);
border-radius: var(--radius-medium);
padding: 15px;
text-align: center;
transition: all 3s ease-in-out;
}
.recovering .metric-item {
background: var(--color-bg-dark-normal);
border-color: var(--color-border-normal);
}
.metric-label {
font-size: 14px;
color: var(--color-text-muted);
margin-bottom: 5px;
transition: all 3s ease-in-out;
}
.recovering .metric-label {
color: var(--color-text-muted-normal);
}
.metric-value {
font-size: 20px;
font-weight: 700;
color: var(--color-text-danger);
transition: all 3s ease-in-out;
}
.recovering .metric-value {
color: var(--color-text-accent-normal);
}
.metric-value.exceeded {
animation: valueFlash 1s ease-in-out infinite;
}
.recovering .metric-value.exceeded {
animation: none;
}
@keyframes valueFlash {
0%, 50% { color: var(--color-text-danger); }
51%, 100% { color: var(--color-text-white); }
}
/* === ERROR LOG === */
.error-log {
background: var(--color-bg-dark);
border: 1px solid var(--color-border);
border-radius: var(--radius-medium);
padding: 15px;
font-family: 'Courier New', monospace;
font-size: 12px;
color: var(--color-text-accent);
max-height: 150px;
overflow-y: auto;
margin-bottom: 20px;
transition: all 3s ease-in-out;
}
.recovering .error-log {
background: var(--color-bg-dark-normal);
border-color: var(--color-border-normal);
color: var(--color-text-accent-normal);
}
.error-line {
margin-bottom: 5px;
opacity: 0;
animation: errorAppear 0.5s ease-out forwards;
transition: all 3s ease-in-out;
}
.error-line:nth-child(1) { animation-delay: 0.5s; }
.error-line:nth-child(2) { animation-delay: 1s; }
.error-line:nth-child(3) { animation-delay: 1.5s; }
.error-line:nth-child(4) { animation-delay: 2s; }
@keyframes errorAppear {
0% {
opacity: 0;
transform: translateX(-10px);
}
100% {
opacity: 1;
transform: translateX(0);
}
}
/* === ACTION BUTTONS === */
.action-buttons {
display: flex;
gap: 20px;
justify-content: center;
flex-wrap: wrap;
}
.action-button {
padding: 15px 30px;
border: 2px solid var(--color-border-accent);
border-radius: var(--radius-medium);
font-size: 16px;
font-weight: 600;
font-family: var(--font-family-mono);
cursor: pointer;
transition: all 0.3s ease;
text-decoration: none;
display: inline-flex;
align-items: center;
gap: 10px;
min-width: 160px;
justify-content: center;
}
.retry-button {
background: var(--color-button);
color: var(--color-text-white);
transition: all 3s ease-in-out;
}
.recovering .retry-button {
background: var(--color-button-normal);
border-color: var(--color-border-accent-normal);
}
.retry-button:hover {
background: var(--color-button-hover);
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(255, 0, 0, 0.4);
}
.recovering .retry-button:hover {
background: var(--color-button-hover-normal);
box-shadow: 0 5px 15px rgba(0, 255, 136, 0.4);
}
.menu-button {
background: transparent;
color: var(--color-text-accent);
transition: all 3s ease-in-out;
}
.recovering .menu-button {
color: var(--color-text-accent-normal);
border-color: var(--color-border-accent-normal);
}
.menu-button:hover {
background: var(--color-bg-hover);
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(255, 68, 68, 0.3);
}
.recovering .menu-button:hover {
background: var(--color-bg-hover-normal);
box-shadow: 0 5px 15px rgba(0, 255, 136, 0.3);
}
/* === SCREEN EFFECTS === */
.screen-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 1000;
background:
repeating-linear-gradient(
0deg,
transparent,
transparent 2px,
rgba(255, 0, 0, 0.03) 2px,
rgba(255, 0, 0, 0.03) 4px
);
animation: scanlines 0.1s linear infinite;
transition: all 3s ease-in-out;
}
.recovering .screen-overlay {
background:
repeating-linear-gradient(
0deg,
transparent,
transparent 2px,
rgba(0, 255, 136, 0.02) 2px,
rgba(0, 255, 136, 0.02) 4px
);
}
@keyframes scanlines {
0% { transform: translateY(0); }
100% { transform: translateY(4px); }
}
/* === RECOVERY MESSAGE === */
.recovery-message {
position: absolute;
top: 20px;
left: 50%;
transform: translateX(-50%);
background: var(--color-bg-accent-normal);
color: var(--color-text-white-normal);
padding: 10px 20px;
border-radius: var(--radius-medium);
font-size: 14px;
font-weight: 600;
opacity: 0;
transition: opacity 1s ease-in-out;
z-index: 100;
}
.recovery-message.show {
opacity: 1;
}
/* === RESPONSIVE === */
@media (max-width: 768px) {
.failure-title {
font-size: 48px;
}
.failure-subtitle {
font-size: 18px;
}
.failure-icon {
font-size: 80px;
}
.failure-metrics {
grid-template-columns: 1fr;
}
.action-buttons {
flex-direction: column;
align-items: center;
}
.action-button {
width: 100%;
max-width: 300px;
}
}
/* === DOOM-STYLE GLITCH EFFECTS === */
.glitch {
position: relative;
}
.glitch::before,
.glitch::after {
content: attr(data-text);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
transition: opacity 3s ease-in-out;
}
.glitch::before {
animation: glitch-1 2s infinite;
color: #ff0000;
z-index: -1;
}
.glitch::after {
animation: glitch-2 2s infinite;
color: #00ff00;
z-index: -2;
}
/* Hide glitch effects during recovery */
.recovering .glitch::before,
.recovering .glitch::after {
opacity: 0;
animation: none;
}
@keyframes glitch-1 {
0%, 14%, 15%, 49%, 50%, 99%, 100% {
transform: translate(0);
}
15%, 49% {
transform: translate(-2px, 0);
}
}
@keyframes glitch-2 {
0%, 20%, 21%, 62%, 63%, 99%, 100% {
transform: translate(0);
}
21%, 62% {
transform: translate(2px, 0);
}
}
</style>
</head>
<body>
<div class="screen-overlay"></div>
<div class="header">
<div class="header-logo-container">
<h1 class="header-text">System Design Game</h1>
<div class="beta-pill">BETA</div>
</div>
</div>
<div class="failure-container">
<h1 class="failure-title glitch" data-text="SYSTEM OVERLOAD" id="failureTitle">SYSTEM OVERLOAD</h1>
<p class="failure-subtitle" id="failureSubtitle">{{.LevelName}} - Your architecture couldn't handle the load</p>
<div class="failure-details">
<div class="failure-reason" id="failureReason">
Critical system failure detected. Your design exceeded operational limits.
{{if .FailedReqs}}
<br><br>Failed requirements:
{{range .FailedReqs}}
<br>• {{.}}
{{end}}
{{end}}
</div>
<div class="failure-metrics">
<div class="metric-item">
<div class="metric-label">Target RPS</div>
<div class="metric-value">{{.TargetRPS | printf "%d"}}</div>
</div>
<div class="metric-item">
<div class="metric-label">Achieved RPS</div>
<div class="metric-value exceeded">{{.AchievedRPS | printf "%d"}}</div>
</div>
<div class="metric-item">
<div class="metric-label">Max Latency</div>
<div class="metric-value">{{.TargetLatency}}ms</div>
</div>
<div class="metric-item">
<div class="metric-label">Actual Latency</div>
<div class="metric-value exceeded">{{.ActualLatency | printf "%.0f"}}ms</div>
</div>
</div>
<div class="error-log" id="errorLog">
<div class="error-line">[ERROR] Database connection pool exhausted</div>
<div class="error-line">[ERROR] Load balancer timeout after 30s</div>
<div class="error-line">[ERROR] Cache miss ratio: 89%</div>
<div class="error-line">[FATAL] System unresponsive - shutting down</div>
{{range .FailedReqs}}
<div class="error-line">[ERROR] {{.}}</div>
{{end}}
</div>
</div>
<div class="action-buttons">
<button class="action-button retry-button" onclick="retryLevel()">
Try Again
</button>
<a href="/game-modes" class="action-button menu-button">
Main Menu
</a>
</div>
</div>
<script>
// Recovery transition after 15 seconds
setTimeout(() => {
// Start recovery transition after message appears
setTimeout(() => {
document.body.classList.add('recovering');
// Update text content during recovery
setTimeout(() => {
document.getElementById('failureTitle').textContent = 'SYSTEM RECOVERED';
document.getElementById('failureSubtitle').textContent = 'Diagnostics complete - Ready to try again';
document.getElementById('failureReason').textContent = 'System has been stabilized. Analysis complete. Ready for next attempt.';
// Update error log to show recovery
const errorLog = document.getElementById('errorLog');
errorLog.innerHTML = `
<div class="error-line">[INFO] Running system diagnostics...</div>
<div class="error-line">[INFO] Database connections restored</div>
<div class="error-line">[INFO] Load balancer optimized</div>
<div class="error-line">[SUCCESS] All systems operational</div>
`;
}, 1500);
// Hide recovery message after transition
setTimeout(() => {
if (typeof recoveryMessage !== 'undefined') {
recoveryMessage.classList.remove('show');
}
}, 3000);
}, 1000);
}, 15000);
// Add retry function
function retryLevel() {
const levelId = '{{.LevelID}}';
const retryUrl = levelId ? `/play/${levelId}?retry=true` : '/game?retry=true';
window.location.href = retryUrl;
}
// Add some random glitch effects (only during failure state)
function addRandomGlitch() {
if (!document.body.classList.contains('recovering')) {
const title = document.querySelector('.failure-title');
title.style.animation = 'none';
setTimeout(() => {
title.style.animation = 'titleGlitch 3s ease-in-out infinite';
}, 100);
}
}
// Trigger random glitches only during failure state
const glitchInterval = setInterval(() => {
if (document.body.classList.contains('recovering')) {
clearInterval(glitchInterval);
} else {
addRandomGlitch();
}
}, 8000);
</script>
</body>
</html>