super-mario / app /globals.css
asemxin
fix: improve touch controls with pointer events and larger buttons
0f0bcb4
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
:root {
--mario-red: #e52521;
--mario-blue: #049cd8;
--mario-yellow: #ffc107;
--mario-green: #43b047;
--sky-blue: #5c94fc;
--gold: #ffd700;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Press Start 2P', cursive;
background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
min-height: 100vh;
overflow: hidden;
}
/* Game Container */
.game-container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 100vh;
min-height: 100dvh;
padding: 10px;
touch-action: none;
user-select: none;
-webkit-user-select: none;
overflow: hidden;
}
/* Game Wrapper for responsive scaling */
.game-wrapper {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
gap: 10px;
}
.canvas-container {
display: flex;
justify-content: center;
align-items: center;
}
.game-canvas {
image-rendering: pixelated;
image-rendering: crisp-edges;
border: 3px solid #333;
border-radius: 8px;
box-shadow:
0 0 0 3px var(--mario-red),
0 0 20px rgba(229, 37, 33, 0.3),
0 10px 40px rgba(0, 0, 0, 0.5);
}
/* Touch Controls */
.touch-controls {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
max-width: 100vw;
padding: 15px 25px;
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: linear-gradient(transparent, rgba(0, 0, 0, 0.4));
z-index: 100;
pointer-events: auto;
}
.dpad {
display: flex;
gap: 20px;
}
.dpad-btn {
width: 75px;
height: 75px;
border-radius: 50%;
border: none;
font-size: 26px;
font-weight: bold;
color: white;
background: linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, rgba(0, 0, 0, 0.2) 100%);
background-color: rgba(100, 100, 100, 0.9);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.3);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
-webkit-tap-highlight-color: transparent;
touch-action: none;
user-select: none;
-webkit-user-select: none;
}
.dpad-btn:active,
.dpad-btn.pressed {
transform: scale(0.92);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
background-color: rgba(60, 60, 60, 0.95);
}
.action-buttons {
display: flex;
align-items: center;
}
.action-btn {
width: 85px;
height: 85px;
border-radius: 50%;
border: none;
font-family: 'Press Start 2P', cursive;
font-size: 22px;
font-weight: bold;
color: white;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
-webkit-tap-highlight-color: transparent;
touch-action: none;
user-select: none;
-webkit-user-select: none;
}
.action-btn.jump {
background: linear-gradient(180deg, #e52521 0%, #b81c1c 100%);
box-shadow: 0 6px 0 #8b0000, 0 8px 12px rgba(0, 0, 0, 0.4);
}
.action-btn.jump:active,
.action-btn.jump.pressed {
transform: translateY(4px);
box-shadow: 0 2px 0 #8b0000, 0 4px 8px rgba(0, 0, 0, 0.4);
}
/* Tablet and larger phones */
@media (min-width: 600px) {
.dpad-btn {
width: 80px;
height: 80px;
font-size: 28px;
}
.action-btn {
width: 90px;
height: 90px;
font-size: 24px;
}
.touch-controls {
padding: 15px 30px;
}
}
/* Loading State */
.loading {
color: white;
font-size: 16px;
animation: blink 1s infinite;
}
@keyframes blink {
0%,
50% {
opacity: 1;
}
51%,
100% {
opacity: 0;
}
}
/* Game Canvas */
.game-canvas {
border: 4px solid #333;
border-radius: 8px;
box-shadow:
0 0 0 4px var(--mario-red),
0 0 30px rgba(229, 37, 33, 0.3),
0 20px 60px rgba(0, 0, 0, 0.5);
image-rendering: pixelated;
background: var(--sky-blue);
}
/* Start Screen */
.start-screen {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 800px;
height: 480px;
background: linear-gradient(180deg, var(--sky-blue) 0%, #87ceeb 60%, var(--mario-green) 60%, #2d5a27 100%);
border: 4px solid #333;
border-radius: 8px;
box-shadow:
0 0 0 4px var(--mario-red),
0 0 30px rgba(229, 37, 33, 0.3),
0 20px 60px rgba(0, 0, 0, 0.5);
position: relative;
overflow: hidden;
}
.start-screen::before {
content: '';
position: absolute;
top: 20%;
left: 10%;
width: 60px;
height: 40px;
background: white;
border-radius: 50%;
box-shadow:
100px 20px 0 30px white,
250px -10px 0 20px white,
400px 10px 0 25px white;
opacity: 0.9;
}
.title-container {
text-align: center;
margin-bottom: 30px;
z-index: 1;
}
.game-title {
font-size: 48px;
color: white;
text-shadow:
4px 4px 0 #000,
-2px -2px 0 #000,
2px -2px 0 #000,
-2px 2px 0 #000;
margin: 0;
letter-spacing: 4px;
}
.game-title.mario {
color: var(--mario-red);
font-size: 56px;
animation: bounce 0.6s ease-in-out infinite alternate;
}
@keyframes bounce {
from {
transform: translateY(0);
}
to {
transform: translateY(-8px);
}
}
.subtitle {
font-size: 14px;
color: var(--mario-yellow);
margin-top: 10px;
text-shadow: 2px 2px 0 #000;
letter-spacing: 6px;
}
/* Level Selection */
.level-buttons {
display: flex;
gap: 10px;
margin-bottom: 15px;
z-index: 1;
}
.level-button {
font-family: 'Press Start 2P', cursive;
font-size: 10px;
padding: 10px 15px;
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
text-shadow: 1px 1px 0 #000;
transition: all 0.1s ease;
}
.level-button.overworld {
background: linear-gradient(180deg, var(--sky-blue) 0%, #4a7acc 100%);
box-shadow: 0 4px 0 #3a5a9c;
}
.level-button.underground {
background: linear-gradient(180deg, #4a4a6a 0%, #2a2a4a 100%);
box-shadow: 0 4px 0 #1a1a3a;
}
.level-button.castle {
background: linear-gradient(180deg, #8b3030 0%, #5a2020 100%);
box-shadow: 0 4px 0 #3a1010;
}
.level-button:hover {
transform: translateY(-2px);
}
.level-button:active {
transform: translateY(2px);
}
.start-button {
font-family: 'Press Start 2P', cursive;
font-size: 18px;
padding: 16px 40px;
background: linear-gradient(180deg, var(--mario-red) 0%, #b81c1c 100%);
color: white;
border: none;
border-radius: 8px;
cursor: pointer;
text-shadow: 2px 2px 0 #000;
box-shadow:
0 6px 0 #8b0000,
0 8px 20px rgba(0, 0, 0, 0.4);
transition: all 0.1s ease;
z-index: 1;
}
.start-button:hover {
transform: translateY(-2px);
box-shadow:
0 8px 0 #8b0000,
0 10px 25px rgba(0, 0, 0, 0.5);
}
.start-button:active {
transform: translateY(4px);
box-shadow:
0 2px 0 #8b0000,
0 4px 10px rgba(0, 0, 0, 0.4);
}
.controls-info {
margin-top: 30px;
background: rgba(0, 0, 0, 0.7);
padding: 20px 30px;
border-radius: 8px;
z-index: 1;
}
.controls-info h3 {
color: var(--mario-yellow);
font-size: 12px;
margin-bottom: 15px;
text-align: center;
}
.control-row {
display: flex;
justify-content: space-between;
align-items: center;
margin: 8px 0;
color: white;
font-size: 10px;
gap: 20px;
}
.key {
background: #444;
padding: 6px 12px;
border-radius: 4px;
border: 2px solid #666;
}
.credits {
position: absolute;
bottom: 20px;
color: white;
font-size: 8px;
text-shadow: 1px 1px 0 #000;
z-index: 1;
}
/* Game Over Screen */
.game-over-screen {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 800px;
height: 480px;
border: 4px solid #333;
border-radius: 8px;
box-shadow:
0 0 0 4px var(--mario-red),
0 0 30px rgba(229, 37, 33, 0.3),
0 20px 60px rgba(0, 0, 0, 0.5);
}
.game-over-screen.win {
background: linear-gradient(180deg, #1a472a 0%, #2d5a27 50%, var(--mario-green) 100%);
}
.game-over-screen.lose {
background: linear-gradient(180deg, #2a1a1a 0%, #4a2020 50%, #3a1515 100%);
}
.result-container {
text-align: center;
}
.result-title {
font-size: 32px;
color: white;
text-shadow:
4px 4px 0 #000,
-2px -2px 0 #000;
margin-bottom: 30px;
}
.score-display {
display: flex;
flex-direction: column;
align-items: center;
background: rgba(0, 0, 0, 0.6);
padding: 20px 40px;
border-radius: 8px;
margin-bottom: 20px;
}
.score-label {
color: #aaa;
font-size: 12px;
margin-bottom: 10px;
}
.score-value {
color: var(--gold);
font-size: 36px;
text-shadow: 2px 2px 0 #000;
}
.win-message {
color: var(--mario-yellow);
font-size: 12px;
margin-bottom: 20px;
text-shadow: 1px 1px 0 #000;
}
.restart-button {
font-family: 'Press Start 2P', cursive;
font-size: 14px;
padding: 14px 30px;
background: linear-gradient(180deg, var(--mario-blue) 0%, #0377a8 100%);
color: white;
border: none;
border-radius: 8px;
cursor: pointer;
text-shadow: 2px 2px 0 #000;
box-shadow:
0 6px 0 #025a7c,
0 8px 20px rgba(0, 0, 0, 0.4);
transition: all 0.1s ease;
margin-top: 20px;
}
.restart-button:hover {
transform: translateY(-2px);
box-shadow:
0 8px 0 #025a7c,
0 10px 25px rgba(0, 0, 0, 0.5);
}
.restart-button:active {
transform: translateY(4px);
box-shadow:
0 2px 0 #025a7c,
0 4px 10px rgba(0, 0, 0, 0.4);
}
/* Responsive */
@media (max-width: 850px) {
.game-canvas,
.start-screen,
.game-over-screen {
width: 100%;
max-width: 800px;
height: auto;
aspect-ratio: 800 / 480;
}
.game-title {
font-size: 32px;
}
.game-title.mario {
font-size: 40px;
}
}