Interactive 2D orbital flight simulator (HTML/CSS/JS, no dependencies). Newtonian gravity with RK4 integration, three scenarios (Surface Launch, Low Orbit, Station Rendezvous), trajectory prediction, camera/zoom, keyboard + touch controls, and automated unit + smoke tests.
136 lines
4.5 KiB
CSS
136 lines
4.5 KiB
CSS
/* Orbital Flight Simulator - dark space theme */
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
|
|
html, body {
|
|
width: 100%;
|
|
height: 100%;
|
|
overflow: hidden;
|
|
background: #04060d;
|
|
font-family: 'Courier New', ui-monospace, monospace;
|
|
color: #dfe9f5;
|
|
-webkit-user-select: none;
|
|
user-select: none;
|
|
}
|
|
|
|
#game {
|
|
position: fixed;
|
|
inset: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
display: block;
|
|
}
|
|
|
|
.hidden { display: none !important; }
|
|
|
|
/* ---------- HUD ---------- */
|
|
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
|
|
|
|
.panel {
|
|
position: absolute;
|
|
background: rgba(8, 14, 26, 0.72);
|
|
border: 1px solid rgba(90, 160, 255, 0.25);
|
|
border-radius: 6px;
|
|
padding: 8px 12px;
|
|
font-size: 13px;
|
|
line-height: 1.5;
|
|
backdrop-filter: blur(2px);
|
|
}
|
|
|
|
.row { display: flex; gap: 10px; align-items: baseline; white-space: nowrap; }
|
|
.label { color: #6f87a8; min-width: 44px; font-size: 11px; letter-spacing: 1px; }
|
|
|
|
#hud-top {
|
|
top: 10px; left: 50%; transform: translateX(-50%);
|
|
display: flex; gap: 16px; align-items: baseline;
|
|
}
|
|
#scenario-name { font-size: 14px; letter-spacing: 2px; color: #9ecbff; }
|
|
.goal { color: #7dff9a; font-size: 12px; }
|
|
|
|
#hud-left { top: 10px; left: 10px; min-width: 170px; }
|
|
#hud-right { top: 10px; right: 10px; min-width: 170px; text-align: left; }
|
|
#hud-dock { bottom: 14px; left: 50%; transform: translateX(-50%); }
|
|
|
|
.fuel-row { margin-top: 4px; }
|
|
.fuel-track {
|
|
display: inline-block; width: 90px; height: 8px;
|
|
background: rgba(255,255,255,0.12); border-radius: 4px; overflow: hidden;
|
|
vertical-align: middle;
|
|
}
|
|
.fuel-fill {
|
|
display: block; height: 100%; width: 100%;
|
|
background: linear-gradient(90deg, #ff7b4f, #ffd166, #7dff9a);
|
|
}
|
|
|
|
.orbit-bound { font-size: 12px; letter-spacing: 1px; }
|
|
#auto-limit { color: #ffb347; font-size: 11px; margin-top: 2px; }
|
|
|
|
/* ---------- Overlays ---------- */
|
|
.overlay {
|
|
position: fixed; inset: 0; z-index: 20;
|
|
display: flex; align-items: center; justify-content: center;
|
|
background: rgba(2, 4, 10, 0.78);
|
|
}
|
|
/* Ready-for-launch: lighter so the pad scene shows through, and it never
|
|
blocks the touch THRUST button (which is what starts the launch). */
|
|
#ready-overlay {
|
|
background: rgba(2, 4, 10, 0.35);
|
|
pointer-events: none;
|
|
}
|
|
.menu-box {
|
|
max-width: 560px; width: calc(100% - 40px);
|
|
background: rgba(10, 16, 30, 0.95);
|
|
border: 1px solid rgba(90, 160, 255, 0.35);
|
|
border-radius: 10px;
|
|
padding: 28px 32px;
|
|
text-align: center;
|
|
box-shadow: 0 0 40px rgba(60, 130, 255, 0.15);
|
|
}
|
|
.menu-box h1 { font-size: 22px; letter-spacing: 3px; color: #9ecbff; margin-bottom: 8px; }
|
|
.menu-box h2 { font-size: 20px; letter-spacing: 2px; margin-bottom: 12px; }
|
|
.tagline { color: #6f87a8; font-size: 12px; margin-bottom: 22px; }
|
|
.tut-text { white-space: pre-line; text-align: left; font-size: 13px; line-height: 1.7; margin-bottom: 18px; color: #c8d6e5; }
|
|
.hint { color: #6f87a8; font-size: 11px; margin-top: 16px; }
|
|
.menu-row { display: flex; gap: 12px; align-items: center; justify-content: center; }
|
|
|
|
/* ---------- Buttons ---------- */
|
|
.btn {
|
|
font-family: inherit; font-size: 13px; letter-spacing: 1px;
|
|
color: #dfe9f5; background: rgba(90, 160, 255, 0.12);
|
|
border: 1px solid rgba(90, 160, 255, 0.45);
|
|
border-radius: 6px; padding: 10px 18px; cursor: pointer;
|
|
transition: background 0.15s, transform 0.05s;
|
|
}
|
|
.btn:hover { background: rgba(90, 160, 255, 0.28); }
|
|
.btn:active { transform: scale(0.97); }
|
|
.btn.big { display: block; width: 100%; margin-bottom: 10px; padding: 13px; font-size: 14px; }
|
|
.btn.ghost { background: transparent; }
|
|
.btn.icon {
|
|
width: 38px; height: 38px; padding: 0;
|
|
font-size: 15px; line-height: 36px; text-align: center;
|
|
}
|
|
|
|
#top-buttons {
|
|
position: fixed; top: 10px; right: 200px; z-index: 15;
|
|
display: flex; gap: 6px;
|
|
}
|
|
@media (max-width: 800px) { #top-buttons { right: 10px; top: auto; bottom: 10px; } }
|
|
|
|
/* ---------- Touch controls ---------- */
|
|
#touch-controls {
|
|
position: fixed; bottom: 18px; left: 0; right: 0; z-index: 15;
|
|
display: flex; justify-content: space-between; align-items: flex-end;
|
|
padding: 0 18px; pointer-events: none;
|
|
}
|
|
.tbtn {
|
|
pointer-events: auto;
|
|
font-family: inherit; font-size: 16px;
|
|
color: #dfe9f5; background: rgba(90, 160, 255, 0.18);
|
|
border: 1px solid rgba(90, 160, 255, 0.5);
|
|
border-radius: 50%; width: 64px; height: 64px;
|
|
touch-action: none;
|
|
}
|
|
.tbtn.active { background: rgba(90, 160, 255, 0.45); }
|
|
.tbtn.thrust { width: 84px; height: 84px; background: rgba(255, 123, 79, 0.25); border-color: rgba(255, 123, 79, 0.6); }
|
|
.tbtn.thrust.active { background: rgba(255, 123, 79, 0.55); }
|
|
.tbtn.time { width: 52px; height: 52px; font-size: 11px; }
|