Neo brutalism design

This commit is contained in:
2026-02-09 22:24:14 +01:00
parent e2f134d3b4
commit 1cfa9f5cd2

View File

@@ -4,166 +4,185 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Wolf & Schafe</title> <title>Wolf & Schafe | Rough Edition</title>
<style> <style>
:root { :root {
--bg: #f8fafc; --bg: #e5e7eb;
--card-bg: #ffffff; --wolf: #ff3e3e;
--wolf-color: #ef4444; --sheep: #3b82f6;
--sheep-color: #3b82f6; --black: #1a1a1a;
--empty-color: #f1f5f9; --surface: #ffffff;
--border-color: #e2e8f0;
--text-main: #1e293b;
--text-sub: #64748b;
--accent: #f59e0b;
} }
body { body {
font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; font-family: 'Courier New', Courier, monospace;
/* Rough, typewriter feel */
background-color: var(--bg); background-color: var(--bg);
color: var(--text-main); color: var(--black);
margin: 0; margin: 0;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
min-height: 100vh; min-height: 100vh;
touch-action: manipulation;
} }
.game-card { /* Large Screen Scaling */
background: var(--card-bg); .game-wrapper {
width: 95%; width: 100%;
max-width: 600px; max-width: 900px;
padding: 1.5rem; /* Increased for big monitors */
border-radius: 16px; padding: 20px;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); box-sizing: border-box;
border: 1px solid var(--border-color);
text-align: center;
} }
header { .main-card {
margin-bottom: 1rem; background: var(--surface);
border: 4px solid var(--black);
box-shadow: 12px 12px 0px var(--black);
/* Brutalist shadow */
padding: 2rem;
display: flex;
flex-direction: column;
gap: 20px;
} }
h2 { /* Clear Identity Section */
margin: 0; .identity-banner {
font-size: 1.1rem; display: flex;
color: var(--text-sub); align-items: center;
font-weight: 500; justify-content: space-between;
border: 3px solid var(--black);
padding: 15px;
background: #f3f4f6;
}
.id-box {
font-size: 1.5rem;
font-weight: 900;
padding: 10px 20px;
border: 3px solid var(--black);
text-transform: uppercase;
}
.is-wolf {
background: var(--wolf);
color: white;
}
.is-sheep {
background: var(--sheep);
color: white;
} }
#status { #status {
font-size: 1.25rem; font-size: 1.2rem;
font-weight: 700; font-weight: bold;
margin: 0.5rem 0; text-align: right;
min-height: 3rem;
line-height: 1.2;
} }
/* Board Scaling */
.board-container { .board-container {
width: 100%; width: 100%;
aspect-ratio: 600 / 420; aspect-ratio: 600 / 420;
position: relative; background: #fff;
border: 3px solid var(--black);
cursor: crosshair;
} }
svg { svg {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: block;
} }
/* SVG Elements */ /* Rough Elements */
.edge { .edge {
stroke: var(--border-color); stroke: var(--black);
stroke-width: 3; stroke-width: 4;
stroke-linecap: round;
} }
.node-circle { .node-circle {
transition: r 0.2s ease, stroke-width 0.2s ease; stroke: var(--black);
stroke: var(--border-color); stroke-width: 3;
stroke-width: 1.5; transition: transform 0.1s;
} }
.empty { .empty {
fill: var(--empty-color); fill: #fff;
} }
.sheep { .sheep {
fill: var(--sheep-color); fill: var(--sheep);
stroke: rgba(0, 0, 0, 0.1);
} }
.wolf { .wolf {
fill: var(--wolf-color); fill: var(--wolf);
stroke: rgba(0, 0, 0, 0.1);
} }
.selected { .selected {
stroke: var(--accent); stroke-width: 6;
stroke-width: 5; stroke: #000;
fill: #fde047;
/* Yellow highlight for selection */
} }
.possible { .possible {
fill: #dcfce7; fill: #fff;
stroke: #22c55e; stroke: #22c55e;
stroke-dasharray: 4; stroke-width: 4;
r: 20; stroke-dasharray: 6;
/* Slightly smaller for indicator */
} }
/* Responsive Controls */ .node-label {
font-family: Arial, sans-serif;
font-weight: 900;
pointer-events: none;
user-select: none;
}
/* Buttons */
.controls { .controls {
margin-top: 1.5rem;
display: grid; display: grid;
grid-template-columns: repeat(2, 1fr); grid-template-columns: repeat(3, 1fr);
gap: 10px; gap: 15px;
} }
button { button {
padding: 12px; border: 3px solid var(--black);
border-radius: 10px;
border: 1px solid var(--border-color);
background: white; background: white;
color: var(--text-main); padding: 15px;
font-weight: 600; font-weight: 900;
cursor: pointer; cursor: pointer;
font-size: 0.9rem; box-shadow: 4px 4px 0px var(--black);
display: flex; text-transform: uppercase;
align-items: center;
justify-content: center;
gap: 6px;
} }
button:active { button:active {
background: #f1f5f9; box-shadow: 0px 0px 0px var(--black);
transform: scale(0.98); transform: translate(4px, 4px);
} }
#exitBtn { button#exitBtn {
grid-column: span 2; background: #fda4af;
background: #fff1f2;
color: #be123c;
border-color: #fecdd3;
} }
#copyRoomBtn { button#copyRoomBtn {
background: #f0f9ff; background: #bae6fd;
color: #0369a1;
border-color: #bae6fd;
} }
@media (max-width: 480px) { @media (max-width: 600px) {
.game-card { .main-card {
padding: 1rem; padding: 10px;
border-radius: 0; border-width: 3px;
width: 100%; box-shadow: 6px 6px 0px var(--black);
min-height: 100vh;
border: none;
} }
#status { .identity-banner {
font-size: 1.1rem; flex-direction: column;
gap: 10px;
}
.controls {
grid-template-columns: 1fr;
} }
} }
</style> </style>
@@ -171,31 +190,35 @@
<body> <body>
<div class="game-card"> <div class="game-wrapper">
<header> <div class="main-card">
<h2 id="roleHeader">Verbinde...</h2> <div class="identity-banner">
<div id="status">Warte auf Mitspieler...</div> <div>
</header> <span style="font-size: 0.8rem; display: block;">DEINE ROLLE:</span>
<div id="idBadge" class="id-box">...</div>
</div>
<div id="status">Laden...</div>
</div>
<div class="board-container"> <div class="board-container">
<svg viewBox="0 0 600 420" preserveAspectRatio="xMidYMid meet"></svg> <svg viewBox="0 0 600 420" preserveAspectRatio="xMidYMid meet"></svg>
</div> </div>
<div class="controls"> <div class="controls">
<button id="copyRoomBtn">📋 Link</button> <button id="copyRoomBtn">Link Kopieren</button>
<button id="restartBtn">🔄 Reset</button> <button id="restartBtn">Neustart</button>
<button id="exitBtn">🚪 Raum verlassen</button> <button id="exitBtn">Verlassen</button>
</div>
</div> </div>
</div> </div>
<script> <script>
// Session and Room Setup
let sessionId = localStorage.getItem("game_session_id") || (Math.random().toString(36).substring(2) + Date.now().toString(36)); let sessionId = localStorage.getItem("game_session_id") || (Math.random().toString(36).substring(2) + Date.now().toString(36));
localStorage.setItem("game_session_id", sessionId); localStorage.setItem("game_session_id", sessionId);
const params = new URLSearchParams(window.location.search); const params = new URLSearchParams(window.location.search);
let roomId = params.get("room"); let roomId = params.get("room");
if (!roomId) roomId = prompt("Raumcode eingeben (leer für neu):") || ""; if (!roomId) roomId = prompt("Code (leer für Neu):") || "";
const protocol = location.protocol === "https:" ? "wss" : "ws"; const protocol = location.protocol === "https:" ? "wss" : "ws";
const ws = new WebSocket(`${protocol}://${location.host}?room=${roomId}&sessionId=${sessionId}`); const ws = new WebSocket(`${protocol}://${location.host}?room=${roomId}&sessionId=${sessionId}`);
@@ -213,7 +236,9 @@
if (msg.type === "role") { if (msg.type === "role") {
myRole = msg.role; myRole = msg.role;
currentRoomId = msg.roomId; currentRoomId = msg.roomId;
document.getElementById("roleHeader").innerText = `${myRole.toUpperCase()} • RAUM ${currentRoomId}`; const badge = document.getElementById("idBadge");
badge.innerText = myRole === "wolf" ? "DER WOLF" : "DIE SCHAFE";
badge.className = `id-box is-${myRole}`;
if (!params.has("room")) window.history.replaceState({}, '', `?room=${currentRoomId}`); if (!params.has("room")) window.history.replaceState({}, '', `?room=${currentRoomId}`);
} }
if (msg.type === "state") { state = msg.game; render(); } if (msg.type === "state") { state = msg.game; render(); }
@@ -225,11 +250,9 @@
const statusEl = document.getElementById("status"); const statusEl = document.getElementById("status");
if (state.winner) { if (state.winner) {
const winColor = state.winner === myRole ? "#059669" : "#dc2626"; statusEl.innerHTML = `ENDE: ${state.winner.toUpperCase()} GEWINNT!`;
statusEl.innerHTML = `<span style="color:${winColor}">${state.winner === myRole ? '🏆 Sieg!' : 'Spiel beendet'}</span>`;
} else { } else {
const turnText = state.turn === myRole ? `<span style="color:var(--text-main)">Du bist dran</span>` : `<span style="color:var(--text-sub)">Gegner zieht...</span>`; statusEl.innerHTML = (state.turn === myRole ? "DU BIST DRAN" : "WARTE...") + `<br><small>ZUG ${state.moveCount}/40</small>`;
statusEl.innerHTML = `${turnText}<br><small style="font-weight:400; font-size: 0.8rem; color: var(--text-sub)">Zug ${state.moveCount}/40</small>`;
} }
edges.forEach(([a, b]) => { edges.forEach(([a, b]) => {
@@ -251,23 +274,23 @@
state.wolf !== i && !state.sheep.includes(i); state.wolf !== i && !state.sheep.includes(i);
const group = document.createElementNS("http://www.w3.org/2000/svg", "g"); const group = document.createElementNS("http://www.w3.org/2000/svg", "g");
group.style.cursor = "pointer";
group.onclick = () => handleClick(i); group.onclick = () => handleClick(i);
const circle = document.createElementNS("http://www.w3.org/2000/svg", "circle"); const circle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
circle.setAttribute("cx", x); circle.setAttribute("cy", y); circle.setAttribute("r", 25); circle.setAttribute("cx", x); circle.setAttribute("cy", y); circle.setAttribute("r", 26);
circle.setAttribute("class", `node-circle ${type} ${selected === i ? 'selected' : ''} ${isPossible ? 'possible' : ''}`); circle.setAttribute("class", `node-circle ${type} ${selected === i ? 'selected' : ''} ${isPossible ? 'possible' : ''}`);
group.appendChild(circle); group.appendChild(circle);
if (type !== "empty") { // Added Numbers back to nodes
const txt = document.createElementNS("http://www.w3.org/2000/svg", "text"); const txt = document.createElementNS("http://www.w3.org/2000/svg", "text");
txt.setAttribute("x", x); txt.setAttribute("y", y + 6); txt.setAttribute("x", x); txt.setAttribute("y", y + 6);
txt.setAttribute("text-anchor", "middle"); txt.setAttribute("text-anchor", "middle");
txt.setAttribute("fill", "white"); txt.setAttribute("class", "node-label");
txt.setAttribute("font-weight", "bold"); txt.setAttribute("fill", (type === "empty" || selected === i) ? "black" : "white");
txt.textContent = type === "wolf" ? "W" : "S"; txt.textContent = i;
group.appendChild(txt); group.appendChild(txt);
}
svg.appendChild(group); svg.appendChild(group);
} }