Files
gomoku/web/css/style.css
T
tiennm99 2635151ce2 feat: add gomoku game type and web client with canvas board engine
Add server-side gomoku (five-in-a-row) as game type 9 with 15x15 board,
2-player rooms, move validation, win detection in 4 directions, and
draw detection. Includes channel-based turn sync with mutex-protected
board access.

Add vanilla JS web client served as static files from the Go server:
WebSocket connection with base64 packet encoding, state machine
navigation, Canvas-based board renderer with gradient stones, hover
ghost, last-move highlight, and game-over overlay.
2026-04-09 22:25:24 +07:00

167 lines
3.3 KiB
CSS

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'Segoe UI', system-ui, sans-serif;
background: #1a1a2e;
color: #e0e0e0;
height: 100vh;
overflow: hidden;
}
header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 24px;
background: #16213e;
border-bottom: 1px solid #0f3460;
}
header h1 { font-size: 1.3rem; color: #e94560; }
#status-indicator {
font-size: 0.85rem;
padding: 4px 12px;
border-radius: 12px;
background: #333;
}
#status-indicator.connected { background: #1b5e20; color: #a5d6a7; }
#main-content {
display: flex;
height: calc(100vh - 52px);
}
.panel { padding: 24px; }
.hidden { display: none !important; }
/* Connect */
#connect-panel {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 12px;
flex: 1;
}
#connect-panel input {
padding: 10px 16px;
font-size: 1rem;
border-radius: 6px;
border: 1px solid #0f3460;
background: #16213e;
color: #e0e0e0;
width: 260px;
text-align: center;
}
button {
padding: 10px 24px;
font-size: 0.95rem;
border: none;
border-radius: 6px;
background: #e94560;
color: white;
cursor: pointer;
transition: background 0.2s;
}
button:hover { background: #c73650; }
button:disabled { background: #555; cursor: not-allowed; }
/* Home */
#home-panel {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 12px;
flex: 1;
}
/* Create */
#create-panel { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; }
#game-type-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.game-type-btn { width: 200px; }
/* Waiting */
#waiting-panel {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 16px;
}
/* Game */
#game-panel {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
padding: 12px;
}
#game-info {
display: flex;
gap: 20px;
margin-bottom: 8px;
font-size: 1rem;
}
#color-label { font-weight: bold; }
#canvas-container {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
max-width: 600px;
max-height: 600px;
width: 100%;
aspect-ratio: 1;
}
#game-canvas { display: block; }
/* Sidebar */
#sidebar {
width: 300px;
display: flex;
flex-direction: column;
border-left: 1px solid #0f3460;
background: #16213e;
}
#log-panel {
flex: 1;
overflow-y: auto;
padding: 12px;
font-size: 0.8rem;
font-family: 'Cascadia Code', 'Fira Code', monospace;
line-height: 1.5;
word-break: break-word;
}
#log-panel .log-entry { margin-bottom: 4px; color: #a0a0c0; }
#log-panel .log-entry.error { color: #e94560; }
#log-panel .log-entry.system { color: #4fc3f7; }
#input-panel {
display: flex;
padding: 8px;
gap: 8px;
border-top: 1px solid #0f3460;
}
#cmd-input {
flex: 1;
padding: 8px 12px;
font-size: 0.9rem;
border-radius: 6px;
border: 1px solid #0f3460;
background: #1a1a2e;
color: #e0e0e0;
}
#send-btn { padding: 8px 16px; font-size: 0.85rem; }
/* Responsive */
@media (max-width: 768px) {
#main-content { flex-direction: column; }
#sidebar { width: 100%; height: 200px; border-left: none; border-top: 1px solid #0f3460; }
#canvas-container { max-width: 90vw; max-height: 50vh; }
}