← Public packages
@kentcdodds/pirate-shooter
Vertical scrolling pirate ship shooter on the open sea, built with Three.js for phone or desktop
public/style.css
154 lines · 2.6 KB · CSS:root {
color-scheme: dark;
--bg: #04121d;
--text: #fef3c7;
--accent: #fbbf24;
--accent-2: #f97316;
font-family: 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
}
* {
box-sizing: border-box;
}
html,
body {
margin: 0;
height: 100%;
background: var(--bg);
color: var(--text);
overflow: hidden;
overscroll-behavior: none;
user-select: none;
-webkit-user-select: none;
-webkit-tap-highlight-color: transparent;
}
body {
display: grid;
place-items: center;
height: 100dvh;
}
#stage {
position: relative;
width: min(100vw, calc(100dvh * 9 / 16));
aspect-ratio: 9 / 16;
overflow: hidden;
background: #0b4f7a;
}
#game {
display: block;
width: 100%;
height: 100%;
touch-action: none;
}
#stage.playing #game {
cursor: none;
}
.hud {
position: absolute;
inset: 0 0 auto;
display: grid;
grid-template-columns: 1fr auto 1fr;
align-items: start;
padding: max(12px, env(safe-area-inset-top)) 14px 0;
font-size: clamp(14px, 2.4dvh, 20px);
letter-spacing: 0.05em;
pointer-events: none;
font-weight: bold;
text-shadow: 0 1px 3px rgb(0 0 0 / 0.8);
}
#lives {
color: var(--accent);
letter-spacing: 0.3em;
}
#high-score {
text-align: right;
opacity: 0.75;
}
.hud-buttons {
position: absolute;
top: calc(max(12px, env(safe-area-inset-top)) + 2.2em);
right: 14px;
display: flex;
gap: 8px;
}
.hud-buttons button {
padding: 6px 10px;
font-size: 12px;
opacity: 0.7;
}
button {
font: inherit;
color: var(--text);
background: rgb(4 18 29 / 0.55);
border: 1px solid rgb(251 191 36 / 0.5);
border-radius: 8px;
cursor: pointer;
}
button:hover,
button:focus-visible {
background: rgb(120 53 15 / 0.75);
outline: none;
}
.overlay {
position: absolute;
inset: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 16px;
padding: 24px;
text-align: center;
background: rgb(4 18 29 / 0.6);
backdrop-filter: blur(2px);
animation: fade-in 0.5s ease-out;
}
.overlay[hidden] {
display: none;
}
.overlay h1 {
margin: 0;
font-size: clamp(28px, 6dvh, 48px);
letter-spacing: 0.08em;
text-transform: uppercase;
background: linear-gradient(90deg, var(--accent), var(--accent-2));
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.overlay p {
margin: 0;
max-width: 36ch;
line-height: 1.6;
white-space: pre-line;
opacity: 0.85;
}
.overlay button {
padding: 12px 32px;
font-size: 18px;
letter-spacing: 0.1em;
text-transform: uppercase;
}
@keyframes fade-in {
from {
opacity: 0;
}
}