redesigned player-display to match style

This commit is contained in:
tom.hempel
2025-10-02 13:59:44 +02:00
parent e1686d828e
commit 57b6c0e234

View File

@ -4,6 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Charades Player Display</title> <title>Charades Player Display</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Roboto+Mono:wght@400;500&display=swap" rel="stylesheet">
<style> <style>
* { * {
margin: 0; margin: 0;
@ -12,150 +13,170 @@
} }
body { body {
font-family: 'Arial', sans-serif; font-family: 'Inter', sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); background: #f5f5f5;
color: white; color: #2c3e50;
height: 100vh; height: 100vh;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
overflow: hidden; padding: 2rem;
} }
.container { .container {
text-align: center; width: 100%;
width: 90%; max-width: 1000px;
max-width: 1200px;
} }
.status-bar { .status-bar {
background: white;
border: 2px solid #2c3e50;
border-radius: 4px;
padding: 1rem 2rem;
margin-bottom: 2rem;
text-align: center;
}
.status-text {
font-size: 1rem;
color: #7f8c8d;
font-weight: 500;
}
.connection-status {
position: fixed; position: fixed;
top: 20px; top: 1.5rem;
left: 50%; right: 1.5rem;
transform: translateX(-50%); padding: 0.5rem 1rem;
background: rgba(0, 0, 0, 0.3); border-radius: 3px;
padding: 10px 30px; font-size: 0.875rem;
border-radius: 25px; font-weight: 500;
font-size: 1.2rem; }
backdrop-filter: blur(10px);
.connected {
background: #27ae60;
color: white;
}
.disconnected {
background: #e74c3c;
color: white;
} }
.word-display { .word-display {
background: rgba(255, 255, 255, 0.1); background: white;
border-radius: 20px; border: 3px solid #2c3e50;
padding: 60px 40px; border-radius: 4px;
margin: 40px 0; padding: 4rem 2rem;
backdrop-filter: blur(15px); text-align: center;
border: 2px solid rgba(255, 255, 255, 0.2); min-height: 400px;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3); display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
} }
.current-word { .current-word {
font-size: 4rem; font-size: 5rem;
font-weight: bold; font-weight: 600;
margin-bottom: 20px; color: #2c3e50;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
line-height: 1.2; line-height: 1.2;
word-wrap: break-word; word-wrap: break-word;
margin-bottom: 2rem;
} }
.timer { .timer {
font-size: 3rem; font-family: 'Roboto Mono', monospace;
color: #ffd700; font-size: 4rem;
font-weight: bold; color: #34495e;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); font-weight: 500;
margin-top: 20px; margin-top: 1rem;
} }
.timer.warning { .timer.warning {
color: #ff6b6b; color: #e67e22;
animation: pulse 1s infinite;
} }
@keyframes pulse { .timer.danger {
0%, 100% { opacity: 1; } color: #e74c3c;
50% { opacity: 0.7; }
} }
.waiting-message { .waiting-message {
font-size: 2rem; font-size: 1.5rem;
opacity: 0.8; color: #95a5a6;
font-style: italic; font-weight: 400;
} }
.last-word-status { .last-word-status {
position: fixed; position: fixed;
bottom: 30px; bottom: 2rem;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
padding: 15px 30px; padding: 1rem 2rem;
border-radius: 15px; border-radius: 4px;
font-size: 1.5rem; font-size: 1.25rem;
font-weight: bold; font-weight: 500;
} }
.status-correct { .status-correct {
background: rgba(76, 175, 80, 0.9); background: #27ae60;
color: white; color: white;
border: 2px solid #229954;
} }
.status-incorrect { .status-incorrect {
background: rgba(244, 67, 54, 0.9); background: #e74c3c;
color: white; color: white;
border: 2px solid #c0392b;
} }
.status-hidden { .status-hidden {
display: none; display: none;
} }
.connection-status {
position: fixed;
top: 20px;
right: 20px;
padding: 10px 20px;
border-radius: 15px;
font-size: 1rem;
font-weight: bold;
}
.connected {
background: rgba(76, 175, 80, 0.9);
}
.disconnected {
background: rgba(244, 67, 54, 0.9);
}
@media (max-width: 768px) { @media (max-width: 768px) {
body {
padding: 1rem;
}
.current-word { .current-word {
font-size: 2.5rem; font-size: 3rem;
} }
.timer { .timer {
font-size: 2rem; font-size: 2.5rem;
} }
.waiting-message { .waiting-message {
font-size: 1.5rem; font-size: 1.25rem;
} }
.word-display { .word-display {
padding: 40px 20px; padding: 3rem 1.5rem;
min-height: 300px;
}
.status-bar {
padding: 0.75rem 1rem;
}
.status-text {
font-size: 0.9rem;
} }
} }
</style> </style>
</head> </head>
<body> <body>
<div class="status-bar">
<span id="player-info">Waiting for game to start...</span>
</div>
<div class="connection-status connected" id="connection-status"> <div class="connection-status connected" id="connection-status">
Connected Connected
</div> </div>
<div class="container"> <div class="container">
<div class="status-bar">
<div id="player-info" class="status-text">Waiting for game to start...</div>
</div>
<div class="word-display"> <div class="word-display">
<div id="current-word" class="current-word" style="display: none;"></div> <div id="current-word" class="current-word" style="display: none;"></div>
<div id="waiting-message" class="waiting-message"> <div id="waiting-message" class="waiting-message">
@ -240,23 +261,24 @@
const seconds = Math.max(0, timeRemaining); const seconds = Math.max(0, timeRemaining);
timerEl.textContent = seconds.toFixed(1) + 's'; timerEl.textContent = seconds.toFixed(1) + 's';
// Add warning class when time is low // Update timer color based on remaining time
if (seconds <= 10) { timerEl.className = 'timer';
if (seconds <= 5) {
timerEl.classList.add('danger');
} else if (seconds <= 10) {
timerEl.classList.add('warning'); timerEl.classList.add('warning');
} else {
timerEl.classList.remove('warning');
} }
} }
function showLastWordStatus(status) { function showLastWordStatus(status) {
if (status === 1) { if (status === 1) {
lastWordStatusEl.textContent = 'Previous word: CORRECT!'; lastWordStatusEl.textContent = 'Previous word: CORRECT';
lastWordStatusEl.className = 'last-word-status status-correct'; lastWordStatusEl.className = 'last-word-status status-correct';
setTimeout(() => { setTimeout(() => {
lastWordStatusEl.className = 'last-word-status status-hidden'; lastWordStatusEl.className = 'last-word-status status-hidden';
}, 3000); }, 3000);
} else if (status === 0) { } else if (status === 0) {
lastWordStatusEl.textContent = 'Previous word: Time up!'; lastWordStatusEl.textContent = 'Previous word: Time Up';
lastWordStatusEl.className = 'last-word-status status-incorrect'; lastWordStatusEl.className = 'last-word-status status-incorrect';
setTimeout(() => { setTimeout(() => {
lastWordStatusEl.className = 'last-word-status status-hidden'; lastWordStatusEl.className = 'last-word-status status-hidden';
@ -299,4 +321,4 @@
}); });
</script> </script>
</body> </body>
</html> </html>