bun-game / styles.css
mdierolf's picture
upload!
d08ebf6 verified
Raw
History Blame Contribute Delete
5.7 kB
/* ============ Bun: The Great Migration — shared styles ============ */
:root {
--bun-cream: #fbf0df;
--bun-shadow: #f6dece;
--rust-orange: #f5772d;
--rust-deep: #b7410e;
--zig-yellow: #f7a41d;
--zig-dark: #8a5a00;
--ink: #1c1917;
--panel: #26221f;
--panel-2: #332d28;
--paper: #fffaf0;
--good: #4ade80;
--bad: #f87171;
--font-ui: 'Nunito', system-ui, -apple-system, sans-serif;
--font-mono: 'JetBrains Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
min-height: 100%;
font-family: var(--font-ui);
background: var(--ink);
color: var(--paper);
}
/* ---------- page frame used by both screens ---------- */
.frame {
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 24px;
position: relative;
overflow: hidden;
}
/* floating code tokens in the background */
.bg-tokens { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.bg-tokens span {
position: absolute;
font-family: var(--font-mono);
font-size: 14px;
opacity: 0.14;
white-space: nowrap;
animation: drift linear infinite;
}
@keyframes drift {
from { transform: translateX(105vw); }
to { transform: translateX(-120%); }
}
/* ---------- title screen ---------- */
.title-wrap {
position: relative;
z-index: 1;
max-width: 780px;
width: 100%;
text-align: center;
}
.logo-row {
display: flex;
align-items: center;
justify-content: center;
gap: 18px;
margin-bottom: 10px;
animation: bob 3.2s ease-in-out infinite;
}
@keyframes bob {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-10px); }
}
.logo-bun { width: 120px; height: auto; filter: drop-shadow(0 12px 24px rgba(0,0,0,.45)); }
.logo-word {
font-size: clamp(56px, 10vw, 92px);
font-weight: 900;
letter-spacing: -0.03em;
line-height: 1;
}
.subtitle {
font-family: var(--font-mono);
color: var(--zig-yellow);
font-size: clamp(14px, 2.4vw, 19px);
letter-spacing: 0.12em;
margin-bottom: 22px;
}
.subtitle .arrow { color: var(--rust-orange); }
.story {
background: rgba(38, 34, 31, 0.85);
border: 1px solid rgba(255, 250, 240, 0.12);
border-radius: 16px;
padding: 20px 24px;
font-size: 16px;
line-height: 1.65;
color: #e7e0d4;
margin-bottom: 26px;
text-align: left;
}
.story b.zig { color: var(--zig-yellow); }
.story b.rust { color: var(--rust-orange); }
.story .mono { font-family: var(--font-mono); font-size: 14px; }
.start-btn {
display: inline-block;
font-family: var(--font-ui);
font-weight: 900;
font-size: 22px;
color: #fff;
background: linear-gradient(180deg, var(--rust-orange), var(--rust-deep));
border: none;
border-radius: 14px;
padding: 16px 44px;
cursor: pointer;
box-shadow: 0 8px 0 #7c2d08, 0 16px 32px rgba(0,0,0,.4);
transition: transform .08s ease, box-shadow .08s ease;
}
.start-btn:hover { transform: translateY(2px); box-shadow: 0 6px 0 #7c2d08, 0 12px 24px rgba(0,0,0,.4); }
.start-btn:active { transform: translateY(6px); box-shadow: 0 2px 0 #7c2d08; }
.controls-card {
margin-top: 28px;
display: flex;
gap: 10px;
flex-wrap: wrap;
justify-content: center;
}
.key {
font-family: var(--font-mono);
font-size: 13px;
background: var(--panel);
border: 1px solid rgba(255,250,240,.18);
border-bottom-width: 3px;
border-radius: 8px;
padding: 7px 12px;
color: #d8cfc0;
}
.key b { color: #fff; }
/* little bees patrolling the title screen */
.bee-flier {
position: absolute;
width: 46px;
z-index: 1;
pointer-events: none;
animation: flyBy linear infinite;
filter: drop-shadow(0 6px 8px rgba(0,0,0,.4));
}
.bee-flier.top { top: 12%; animation-duration: 14s; }
.bee-flier.bot { bottom: 14%; animation-duration: 19s; animation-delay: -8s; transform: scaleX(-1); }
@keyframes flyBy {
0% { left: -80px; margin-top: 0; }
25% { margin-top: -22px; }
50% { margin-top: 14px; }
75% { margin-top: -12px; }
100% { left: 105vw; margin-top: 0; }
}
/* ---------- game screen ---------- */
.game-shell { position: relative; z-index: 1; width: min(960px, 100%); }
.canvas-wrap {
position: relative;
border-radius: 16px;
overflow: hidden;
border: 3px solid #000;
box-shadow: 0 24px 60px rgba(0,0,0,.55), 0 0 0 2px rgba(255,250,240,.08);
background: #0e1a2f;
}
canvas#game { display: block; width: 100%; height: auto; }
/* HTML overlay (pause / game over / win) */
.overlay {
position: absolute;
inset: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 16px;
background: rgba(14, 12, 10, 0.78);
backdrop-filter: blur(3px);
text-align: center;
padding: 24px;
}
.overlay.hidden { display: none; }
.overlay h2 { font-size: clamp(28px, 5vw, 46px); font-weight: 900; }
.overlay p { font-family: var(--font-mono); font-size: 14px; color: #d8cfc0; line-height: 1.7; white-space: pre-line; }
.overlay .win-h { color: var(--rust-orange); text-shadow: 0 3px 0 rgba(0,0,0,.4); }
.overlay .lose-h { color: var(--bad); text-shadow: 0 3px 0 rgba(0,0,0,.4); }
.overlay .bun-small { width: 90px; animation: bob 2.6s ease-in-out infinite; }
.overlay .bun-small.sad {
filter: grayscale(.9);
transform: rotate(14deg) translateY(6px);
animation: none;
}
.game-foot {
margin-top: 14px;
display: flex;
justify-content: space-between;
align-items: center;
font-family: var(--font-mono);
font-size: 12px;
color: #8a8073;
}
.game-foot a { color: var(--rust-orange); text-decoration: none; }
@media (max-width: 640px) {
.story { font-size: 14px; padding: 16px; }
.controls-card .key { font-size: 11px; padding: 6px 9px; }
}