Files
race-game/public/style.css
2026-02-18 13:55:52 +00:00

872 lines
17 KiB
CSS

/* ═══════════════════════════════════════
BASE & RESET
═══════════════════════════════════════ */
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
:root {
--bg: #0f1117;
--surface: #1a1d2e;
--surface2: #232740;
--track-green: #0d3320;
--track-line: #1a5c3a;
--accent-yellow: #f5c518;
--accent-red: #e74c3c;
--accent-blue: #3498db;
--accent-green: #2ecc71;
--text: #eef0f7;
--text-muted: #8891a8;
--radius: 14px;
--shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
html, body {
height: 100%;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
background: var(--bg);
color: var(--text);
min-height: 100vh;
overflow-x: hidden;
}
/* ═══════════════════════════════════════
SCREENS
═══════════════════════════════════════ */
.screen {
display: none;
min-height: 100vh;
}
.screen.active {
display: flex;
}
/* ═══════════════════════════════════════
SHARED COMPONENTS
═══════════════════════════════════════ */
.card {
background: var(--surface);
border-radius: var(--radius);
padding: 28px 32px;
box-shadow: var(--shadow);
border: 1px solid rgba(255, 255, 255, 0.06);
}
.btn {
display: inline-block;
padding: 13px 22px;
border: none;
border-radius: 10px;
font-size: 1rem;
font-weight: 700;
cursor: pointer;
transition: transform 0.1s, filter 0.15s;
letter-spacing: 0.3px;
text-align: center;
}
.btn:hover {
filter: brightness(1.12);
transform: translateY(-1px);
}
.btn:active {
transform: translateY(0);
filter: brightness(0.95);
}
.btn-red { background: var(--accent-red); color: #fff; }
.btn-blue { background: var(--accent-blue); color: #fff; }
.btn-green { background: var(--accent-green); color: #fff; }
.btn-hint { background: var(--surface2); color: var(--accent-yellow); border: 1px solid var(--accent-yellow); font-size: 0.9rem; padding: 9px 16px; }
.btn-icon {
background: none;
border: none;
font-size: 1.2rem;
cursor: pointer;
padding: 4px 8px;
border-radius: 8px;
transition: background 0.15s;
}
.btn-icon:hover {
background: rgba(255,255,255,0.1);
}
input[type="text"] {
display: block;
width: 100%;
padding: 13px 16px;
background: var(--surface2);
border: 2px solid rgba(255, 255, 255, 0.08);
border-radius: 10px;
color: var(--text);
font-size: 1rem;
margin-bottom: 14px;
transition: border-color 0.2s;
}
input[type="text"]:focus {
outline: none;
border-color: var(--accent-yellow);
}
input[type="text"]::placeholder {
color: var(--text-muted);
}
.error-msg {
color: var(--accent-red);
font-size: 0.9rem;
min-height: 22px;
text-align: center;
margin-top: 8px;
font-weight: 600;
}
.waiting-text {
color: var(--text-muted);
text-align: center;
font-size: 0.95rem;
}
/* ═══════════════════════════════════════
HOME SCREEN
═══════════════════════════════════════ */
#home-screen {
align-items: center;
justify-content: center;
padding: 20px;
background:
radial-gradient(ellipse at 20% 50%, rgba(231,76,60,0.15) 0%, transparent 60%),
radial-gradient(ellipse at 80% 50%, rgba(52,152,219,0.15) 0%, transparent 60%),
var(--bg);
}
.home-wrapper {
width: 100%;
max-width: 420px;
}
.home-logo {
text-align: center;
margin-bottom: 28px;
}
.logo-cars {
font-size: 2.8rem;
margin-bottom: 8px;
animation: carsSlide 3s ease-in-out infinite alternate;
}
@keyframes carsSlide {
from { letter-spacing: 2px; }
to { letter-spacing: 12px; }
}
.home-logo h1 {
font-size: 2.8rem;
font-weight: 900;
color: var(--accent-yellow);
text-shadow: 0 0 30px rgba(245, 197, 24, 0.5);
letter-spacing: -0.5px;
}
.tagline {
color: var(--text-muted);
margin-top: 6px;
font-size: 1rem;
}
.input-label {
display: block;
font-size: 0.85rem;
font-weight: 600;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.8px;
margin-bottom: 6px;
}
/* Tabs */
.tabs {
display: flex;
background: var(--surface2);
border-radius: 10px;
padding: 4px;
margin-bottom: 20px;
}
.tab-btn {
flex: 1;
padding: 10px;
border: none;
background: none;
border-radius: 8px;
color: var(--text-muted);
font-size: 0.95rem;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
}
.tab-btn.active {
background: var(--surface);
color: var(--text);
box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
}
.tab-desc {
font-size: 0.88rem;
color: var(--text-muted);
margin-bottom: 14px;
line-height: 1.4;
}
.home-footer {
text-align: center;
color: var(--text-muted);
font-size: 0.82rem;
margin-top: 20px;
}
/* ═══════════════════════════════════════
LOBBY SCREEN
═══════════════════════════════════════ */
#lobby-screen {
align-items: center;
justify-content: center;
padding: 20px;
}
.lobby-wrapper {
width: 100%;
max-width: 480px;
}
.lobby-header {
text-align: center;
margin-bottom: 24px;
}
.lobby-header h1 {
font-size: 2rem;
color: var(--accent-yellow);
margin-bottom: 12px;
}
.room-code-box {
display: inline-flex;
align-items: center;
gap: 10px;
background: var(--surface2);
border-radius: 12px;
padding: 10px 20px;
border: 1px solid rgba(245, 197, 24, 0.3);
}
.room-code-label {
font-size: 0.8rem;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 1px;
}
.room-code-val {
font-size: 1.6rem;
font-weight: 900;
color: var(--accent-yellow);
letter-spacing: 6px;
font-family: monospace;
}
.lobby-wrapper .card h3 {
font-size: 1.05rem;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.8px;
margin-bottom: 16px;
display: flex;
align-items: center;
gap: 10px;
}
.count-badge {
background: var(--accent-yellow);
color: #111;
font-size: 0.8rem;
padding: 2px 9px;
border-radius: 20px;
font-weight: 800;
}
.player-list {
display: flex;
flex-direction: column;
gap: 10px;
min-height: 60px;
margin-bottom: 20px;
}
.lobby-player {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 16px;
background: var(--surface2);
border-radius: 10px;
border-left: 4px solid;
font-weight: 600;
animation: slideIn 0.25s ease;
}
@keyframes slideIn {
from { opacity: 0; transform: translateY(-8px); }
to { opacity: 1; transform: translateY(0); }
}
.you-badge {
background: var(--accent-yellow);
color: #111;
font-size: 0.72rem;
font-weight: 800;
padding: 2px 8px;
border-radius: 10px;
text-transform: uppercase;
}
.host-badge {
background: var(--accent-red);
color: #fff;
font-size: 0.72rem;
font-weight: 800;
padding: 2px 8px;
border-radius: 10px;
}
.lobby-actions {
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
margin-bottom: 14px;
}
#start-btn {
width: 100%;
font-size: 1.1rem;
padding: 15px;
}
.lobby-hint {
font-size: 0.82rem;
color: var(--text-muted);
text-align: center;
}
.race-rules {
display: flex;
flex-direction: column;
gap: 8px;
margin-top: 20px;
}
.rule {
background: var(--surface);
border-radius: 10px;
padding: 10px 16px;
font-size: 0.88rem;
color: var(--text-muted);
border: 1px solid rgba(255,255,255,0.05);
}
/* ═══════════════════════════════════════
GAME SCREEN
═══════════════════════════════════════ */
#game-screen {
flex-direction: column;
padding: 0;
}
.game-wrapper {
display: flex;
flex-direction: column;
min-height: 100vh;
max-width: 900px;
margin: 0 auto;
width: 100%;
padding: 0 16px 20px;
}
.game-topbar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 14px 0 10px;
border-bottom: 1px solid rgba(255,255,255,0.07);
margin-bottom: 16px;
}
.topbar-title {
font-size: 1.1rem;
font-weight: 800;
color: var(--accent-yellow);
}
.room-badge {
background: var(--surface2);
border: 1px solid rgba(245,197,24,0.3);
color: var(--accent-yellow);
font-family: monospace;
font-size: 0.85rem;
font-weight: 700;
padding: 4px 12px;
border-radius: 20px;
letter-spacing: 3px;
}
/* ── Race Track ── */
.track-section {
background: var(--track-green);
border-radius: 14px;
padding: 16px 20px;
margin-bottom: 16px;
border: 1px solid rgba(46, 204, 113, 0.2);
box-shadow: inset 0 2px 12px rgba(0,0,0,0.3);
}
.race-track {
display: flex;
flex-direction: column;
gap: 12px;
}
.track-row {
display: flex;
align-items: center;
gap: 10px;
}
.player-label {
width: 110px;
min-width: 110px;
font-size: 0.85rem;
font-weight: 700;
text-align: right;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #fff;
}
.track-bar {
flex: 1;
height: 42px;
background: var(--track-line);
border-radius: 21px;
position: relative;
border: 2px solid rgba(46,204,113,0.3);
overflow: visible;
}
/* Dashed center line */
.track-bar::before {
content: '';
position: absolute;
top: 50%;
left: 5%;
right: 5%;
height: 2px;
background: repeating-linear-gradient(
90deg,
rgba(255,255,255,0.15) 0px,
rgba(255,255,255,0.15) 12px,
transparent 12px,
transparent 24px
);
transform: translateY(-50%);
pointer-events: none;
}
.car-emoji {
position: absolute;
top: 50%;
left: 4%;
transform: translateY(-50%);
font-size: 1.6rem;
transition: left 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
z-index: 5;
line-height: 1;
filter: drop-shadow(0 3px 6px rgba(0,0,0,0.5));
will-change: left;
}
.car-emoji.boosting {
animation: carBoost 0.4s ease;
}
@keyframes carBoost {
0% { filter: drop-shadow(0 3px 6px rgba(0,0,0,0.5)); transform: translateY(-50%) scale(1); }
40% { filter: drop-shadow(0 0 14px rgba(245,197,24,0.9)); transform: translateY(-50%) scale(1.35); }
100% { filter: drop-shadow(0 3px 6px rgba(0,0,0,0.5)); transform: translateY(-50%) scale(1); }
}
.finish-col {
display: flex;
align-items: center;
gap: 6px;
min-width: 44px;
}
.finish-flag {
font-size: 1.4rem;
}
.place-badge {
background: var(--accent-yellow);
color: #111;
font-size: 0.72rem;
font-weight: 900;
padding: 2px 7px;
border-radius: 10px;
white-space: nowrap;
}
/* ── Riddle Panel ── */
.riddle-panel {
background: var(--surface);
border-radius: var(--radius);
padding: 24px 28px;
border: 1px solid rgba(255,255,255,0.06);
flex: 1;
}
.riddle-header {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 18px;
flex-wrap: wrap;
}
.riddle-counter {
font-size: 0.85rem;
font-weight: 700;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.5px;
white-space: nowrap;
}
.progress-outer {
flex: 1;
height: 8px;
background: var(--surface2);
border-radius: 4px;
overflow: hidden;
min-width: 60px;
}
.progress-fill {
height: 100%;
background: linear-gradient(90deg, var(--accent-green), var(--accent-yellow));
border-radius: 4px;
transition: width 0.5s ease;
}
.riddle-question {
font-size: 1.15rem;
line-height: 1.65;
color: var(--accent-yellow);
margin-bottom: 22px;
font-style: italic;
}
.answer-row {
display: flex;
gap: 10px;
margin-bottom: 14px;
}
.answer-input {
flex: 1;
margin-bottom: 0 !important;
font-size: 1.05rem;
}
.submit-btn {
white-space: nowrap;
flex-shrink: 0;
}
.riddle-footer {
display: flex;
align-items: center;
gap: 14px;
flex-wrap: wrap;
}
.feedback {
font-size: 0.95rem;
font-weight: 700;
min-height: 22px;
transition: opacity 0.3s;
}
.feedback.correct { color: var(--accent-green); }
.feedback.wrong { color: var(--accent-red); }
.hint-box {
margin-top: 14px;
background: rgba(245, 197, 24, 0.08);
border: 1px solid rgba(245, 197, 24, 0.3);
border-radius: 10px;
padding: 12px 16px;
font-size: 0.92rem;
color: var(--text);
line-height: 1.5;
animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(4px); }
to { opacity: 1; transform: translateY(0); }
}
.hint-label {
font-weight: 700;
color: var(--accent-yellow);
margin-right: 6px;
}
/* ── Finished Banner ── */
.finished-banner {
background: var(--surface);
border-radius: var(--radius);
padding: 28px;
text-align: center;
flex: 1;
display: flex;
align-items: center;
justify-content: center;
border: 2px solid rgba(245,197,24,0.3);
}
.finished-inner {
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
}
.finished-trophy {
font-size: 4rem;
animation: trophyBounce 1s ease infinite alternate;
}
@keyframes trophyBounce {
from { transform: translateY(0); }
to { transform: translateY(-8px); }
}
#finished-text {
font-size: 1.5rem;
font-weight: 900;
color: var(--accent-yellow);
}
.finished-sub {
color: var(--text-muted);
font-size: 0.9rem;
}
/* ═══════════════════════════════════════
RESULTS SCREEN
═══════════════════════════════════════ */
#results-screen {
align-items: center;
justify-content: center;
padding: 20px;
background:
radial-gradient(ellipse at 50% 0%, rgba(245,197,24,0.18) 0%, transparent 60%),
var(--bg);
}
.results-wrapper {
width: 100%;
max-width: 500px;
}
.results-header {
text-align: center;
margin-bottom: 28px;
}
.results-flags {
font-size: 2rem;
margin-bottom: 8px;
animation: wave 1.5s ease-in-out infinite;
}
@keyframes wave {
0%, 100% { transform: rotate(-5deg); }
50% { transform: rotate(5deg); }
}
.results-header h1 {
font-size: 2.4rem;
font-weight: 900;
color: var(--accent-yellow);
}
.results-sub {
color: var(--text-muted);
font-size: 1rem;
margin-top: 6px;
}
.results-list {
display: flex;
flex-direction: column;
gap: 12px;
margin-bottom: 28px;
}
.result-item {
display: flex;
align-items: center;
gap: 16px;
background: var(--surface);
border-radius: var(--radius);
padding: 16px 22px;
border: 1px solid rgba(255,255,255,0.06);
animation: slideIn 0.35s ease both;
}
.result-item:nth-child(1) { border-left: 4px solid #ffd700; animation-delay: 0.05s; }
.result-item:nth-child(2) { border-left: 4px solid #c0c0c0; animation-delay: 0.15s; }
.result-item:nth-child(3) { border-left: 4px solid #cd7f32; animation-delay: 0.25s; }
.result-item:nth-child(n+4) { animation-delay: 0.35s; }
.result-medal {
font-size: 2.2rem;
width: 50px;
text-align: center;
flex-shrink: 0;
}
.result-place {
font-size: 1.6rem;
font-weight: 900;
width: 50px;
text-align: center;
color: var(--text-muted);
flex-shrink: 0;
}
.result-name {
flex: 1;
font-size: 1.15rem;
font-weight: 700;
}
.results-actions {
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
}
#play-again-btn {
width: 100%;
max-width: 280px;
padding: 15px;
font-size: 1.05rem;
}
/* ═══════════════════════════════════════
NOTIFICATIONS
═══════════════════════════════════════ */
#notif-container {
position: fixed;
top: 16px;
right: 16px;
display: flex;
flex-direction: column;
gap: 10px;
z-index: 9999;
pointer-events: none;
}
.notif {
background: var(--surface);
border: 1px solid rgba(245, 197, 24, 0.4);
border-radius: 12px;
padding: 13px 20px;
font-size: 0.92rem;
font-weight: 600;
max-width: 300px;
animation: notifIn 0.3s ease, notifOut 0.4s ease 2.6s forwards;
box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.notif.finish-notif {
border-color: var(--accent-green);
background: rgba(46, 204, 113, 0.12);
}
@keyframes notifIn {
from { opacity: 0; transform: translateX(40px); }
to { opacity: 1; transform: translateX(0); }
}
@keyframes notifOut {
to { opacity: 0; transform: translateX(40px); }
}
/* ═══════════════════════════════════════
RESPONSIVE
═══════════════════════════════════════ */
@media (max-width: 600px) {
.player-label {
width: 80px;
min-width: 80px;
font-size: 0.78rem;
}
.riddle-panel {
padding: 18px 16px;
}
.answer-row {
flex-direction: column;
}
.submit-btn {
width: 100%;
}
.card {
padding: 20px 18px;
}
.home-logo h1 {
font-size: 2.2rem;
}
}