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