M7: Frontend - HTML/JS/CSS mit dunklem Design, Vollbild, WebSocket-Updates, embed.FS-Integration

- Frontend: index.html, style.css, app.js
  - Dunkles Kontrast-Design mit Team-Farben (Rot/Grün)
  - Vollbild-Toggle, Responsive Design
  - Echtzeit-Updates über WebSocket + Polling-Fallback
  - Tastatur-Shortcuts (R/G für Punkte, N für nächste Runde)
  - Rundenverlauf mit Farbcodierung

- Go-Integration:
  - frontend.go: embed.FS für statische Dateien
  - websocket.go: WebSocket-Handler (/ws) für State-Broadcast
  - httpapi.go: broadcastState() nach jeder Mutation, /ws-Route
  - main.go: api.SetupFrontend() für Frontend-Einbettung
  - Frontend unter '/' verfügbar, API unter '/api/'

- Tests: 17 End-to-End-Tests bestanden
  - Alle HTTP-Endpunkte funktionsfähig
  - Frontend-Assets korrekt eingebettet
  - Persistenz (state.json) funktioniert
This commit is contained in:
2026-07-14 16:32:21 +02:00
parent ac9d7eff1d
commit bd05edfb9c
9 changed files with 1669 additions and 30 deletions
+624
View File
@@ -0,0 +1,624 @@
/* ========================================
goSportpunktetafel – Stylesheet
Dunkles, kontrastreiches Design
======================================== */
/* ---------- CSS Custom Properties ---------- */
:root {
--bg-primary: #0a0a1a;
--bg-secondary: #12122a;
--bg-tertiary: #1a1a3e;
--bg-card: #16163a;
--text-primary: #f0f0ff;
--text-secondary: #a0a0cc;
--text-muted: #606090;
--team-red: #ff2244;
--team-red-dim: #aa1133;
--team-red-glow: rgba(255, 34, 68, 0.4);
--team-red-bg: rgba(255, 34, 68, 0.08);
--team-green: #22dd55;
--team-green-dim: #11aa33;
--team-green-glow: rgba(34, 221, 85, 0.4);
--team-green-bg: rgba(34, 221, 85, 0.08);
--accent-gold: #ffcc00;
--accent-gold-dim: #b38f00;
--border-color: #2a2a55;
--border-radius: 8px;
--border-radius-lg: 12px;
--font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
--score-size: clamp(60px, 15vw, 140px);
--label-size: clamp(20px, 4vw, 42px);
--header-title-size: clamp(14px, 2.5vw, 24px);
--round-text-size: clamp(14px, 2.5vw, 22px);
--transition-speed: 0.2s;
--transition-bounce: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* ---------- Reset & Base ---------- */
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
font-size: 16px;
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: transparent;
touch-action: manipulation;
}
body {
font-family: var(--font-family);
background-color: var(--bg-primary);
color: var(--text-primary);
min-height: 100vh;
min-height: 100dvh;
overflow: hidden;
line-height: 1.4;
user-select: none;
-webkit-user-select: none;
}
/* ---------- Fullscreen Container ---------- */
.fullscreen-container {
display: grid;
grid-template-rows: auto auto 1fr auto auto;
height: 100vh;
height: 100dvh;
max-width: 100vw;
overflow: hidden;
}
/* ---------- Header ---------- */
.app-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 16px;
background: var(--bg-secondary);
border-bottom: 1px solid var(--border-color);
min-height: 60px;
gap: 12px;
flex-shrink: 0;
}
.header-left,
.header-right {
display: flex;
align-items: center;
gap: 12px;
flex-shrink: 0;
}
.header-center {
flex: 1;
text-align: center;
}
.app-title {
font-size: var(--header-title-size);
font-weight: 700;
letter-spacing: 0.5px;
white-space: nowrap;
color: var(--text-primary);
}
.round-display {
font-size: var(--round-text-size);
font-weight: 600;
color: var(--text-secondary);
white-space: nowrap;
}
/* ---------- Buttons ---------- */
.fullscreen-btn,
.reset-btn {
display: flex;
align-items: center;
gap: 6px;
padding: 8px 14px;
border: 1px solid var(--border-color);
border-radius: var(--border-radius);
background: var(--bg-tertiary);
color: var(--text-primary);
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: background var(--transition-speed), border-color var(--transition-speed), transform var(--transition-speed);
-webkit-tap-highlight-color: transparent;
min-height: 40px;
font-family: inherit;
}
.fullscreen-btn:hover,
.reset-btn:hover {
background: var(--border-color);
border-color: var(--text-muted);
}
.fullscreen-btn:active,
.reset-btn:active {
transform: scale(0.96);
}
.icon {
width: 20px;
height: 20px;
flex-shrink: 0;
}
.icon-sm {
width: 16px;
height: 16px;
}
/* ---------- Error Banner ---------- */
.error-banner {
background: rgba(255, 50, 50, 0.15);
border-bottom: 1px solid rgba(255, 50, 50, 0.4);
color: #ff6b6b;
text-align: center;
padding: 8px 16px;
font-size: 14px;
font-weight: 600;
animation: errorShake 0.3s ease-in-out;
flex-shrink: 0;
}
.error-banner.hidden {
display: none;
}
@keyframes errorShake {
0%, 100% { transform: translateX(0); }
25% { transform: translateX(-4px); }
75% { transform: translateX(4px); }
}
/* ---------- Scoreboard ---------- */
.scoreboard {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 0;
padding: 16px;
min-height: 0;
}
/* ---------- Team Panel ---------- */
.team-panel {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 20px 16px;
border-radius: var(--border-radius-lg);
position: relative;
overflow: hidden;
transition: box-shadow var(--transition-speed);
}
.team-panel::before {
content: '';
position: absolute;
inset: 0;
opacity: 0.03;
border-radius: inherit;
pointer-events: none;
}
/* Red Team */
.red-team {
background: var(--team-red-bg);
border: 2px solid var(--team-red-dim);
border-right: 1px solid var(--border-color);
border-radius: var(--border-radius-lg) 0 0 var(--border-radius-lg);
}
.red-team::before {
background: linear-gradient(135deg, var(--team-red) 0%, transparent 60%);
opacity: 0.05;
}
/* Green Team */
.green-team {
background: var(--team-green-bg);
border: 2px solid var(--team-green-dim);
border-left: 1px solid var(--border-color);
border-radius: 0 var(--border-radius-lg) var(--border-radius-lg) 0;
}
.green-team::before {
background: linear-gradient(225deg, var(--team-green) 0%, transparent 60%);
opacity: 0.05;
}
/* Color bar on top */
.team-color-bar {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 4px;
}
.red-team .team-color-bar {
background: linear-gradient(90deg, var(--team-red-dim), var(--team-red), var(--team-red-dim));
}
.green-team .team-color-bar {
background: linear-gradient(90deg, var(--team-green-dim), var(--team-green), var(--team-green-dim));
}
/* Team Label */
.team-label {
font-size: var(--label-size);
font-weight: 700;
letter-spacing: 3px;
text-transform: uppercase;
padding-bottom: 8px;
}
.red-team .team-label {
color: var(--team-red);
}
.green-team .team-label {
color: var(--team-green);
}
/* Score Value */
.score-value {
display: block;
font-size: var(--score-size);
font-weight: 800;
line-height: 1;
font-variant-numeric: tabular-nums;
letter-spacing: -1px;
color: var(--text-primary);
transition: color var(--transition-speed);
}
/* Points indicator */
.last-points {
font-size: clamp(12px, 1.8vw, 16px);
color: var(--text-secondary);
margin-top: 8px;
font-weight: 500;
min-height: 1.4em;
}
/* ---------- Flash Animation for Score Updates ---------- */
@keyframes scoreFlashRed {
0% { transform: scale(1); color: var(--text-primary); }
30% { transform: scale(1.12); color: #fff; }
100% { transform: scale(1); color: var(--text-primary); }
}
@keyframes scoreFlashGreen {
0% { transform: scale(1); color: var(--text-primary); }
30% { transform: scale(1.12); color: #fff; }
100% { transform: scale(1); color: var(--text-primary); }
}
.flash-red {
animation: scoreFlashRed 0.4s ease-out;
}
.flash-green {
animation: scoreFlashGreen 0.4s ease-out;
}
/* ---------- Round History ---------- */
.round-history {
background: var(--bg-secondary);
border-top: 1px solid var(--border-color);
padding: 8px 12px;
flex-shrink: 0;
}
.rounds-list {
display: flex;
gap: 6px;
overflow-x: auto;
overflow-y: hidden;
padding: 4px 0;
scroll-behavior: smooth;
-webkit-overflow-scrolling: touch;
scrollbar-width: thin;
scrollbar-color: var(--border-color) transparent;
}
.rounds-list::-webkit-scrollbar {
height: 4px;
}
.rounds-list::-webkit-scrollbar-track {
background: transparent;
}
.rounds-list::-webkit-scrollbar-thumb {
background: var(--border-color);
border-radius: 2px;
}
/* Round Tile */
.round-tile {
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
padding: 6px 10px;
min-width: 60px;
border-radius: var(--border-radius);
font-size: 13px;
font-weight: 600;
font-variant-numeric: tabular-nums;
border: 1px solid var(--border-color);
background: var(--bg-tertiary);
color: var(--text-secondary);
white-space: nowrap;
}
.round-tile.active {
border-color: var(--accent-gold);
background: rgba(255, 204, 0, 0.1);
color: var(--accent-gold);
box-shadow: 0 0 8px rgba(255, 204, 0, 0.15);
}
.round-tile .score-red {
color: var(--team-red);
}
.round-tile .score-green {
color: var(--team-green);
}
.round-tile .round-num {
color: var(--text-muted);
font-size: 11px;
margin-right: 2px;
}
/* ---------- Connection Status ---------- */
.connection-status {
position: fixed;
bottom: 4px;
right: 8px;
display: flex;
align-items: center;
gap: 6px;
font-size: 11px;
color: var(--text-muted);
padding: 4px 8px;
border-radius: 4px;
background: rgba(10, 10, 26, 0.8);
z-index: 100;
}
.status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--text-muted);
flex-shrink: 0;
transition: background var(--transition-speed);
}
.status-dot.connected {
background: var(--team-green);
box-shadow: 0 0 4px var(--team-green-glow);
}
.status-dot.disconnected {
background: var(--team-red);
box-shadow: 0 0 4px var(--team-red-glow);
}
/* ---------- Modal / Dialog ---------- */
.modal-overlay {
position: fixed;
inset: 0;
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
background: rgba(0, 0, 0, 0.7);
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
padding: 20px;
}
.modal-overlay.hidden {
display: none;
}
.modal-dialog {
background: var(--bg-secondary);
border: 1px solid var(--border-color);
border-radius: var(--border-radius-lg);
padding: 32px;
max-width: 380px;
width: 100%;
text-align: center;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal-title {
font-size: 20px;
font-weight: 700;
margin-bottom: 12px;
color: var(--text-primary);
}
.modal-text {
font-size: 14px;
color: var(--text-secondary);
margin-bottom: 24px;
}
.modal-actions {
display: flex;
gap: 12px;
justify-content: center;
}
.modal-btn {
padding: 12px 24px;
border: 1px solid var(--border-color);
border-radius: var(--border-radius);
font-size: 15px;
font-weight: 600;
cursor: pointer;
transition: all var(--transition-speed);
min-width: 100px;
font-family: inherit;
min-height: 44px;
-webkit-tap-highlight-color: transparent;
}
.modal-btn-secondary {
background: var(--bg-tertiary);
color: var(--text-primary);
}
.modal-btn-secondary:hover {
background: var(--border-color);
}
.modal-btn-danger {
background: var(--team-red);
color: #fff;
border-color: var(--team-red);
}
.modal-btn-danger:hover {
background: var(--team-red-dim);
border-color: var(--team-red-dim);
}
/* ---------- Hidden Utility ---------- */
.hidden {
display: none !important;
}
/* ---------- Responsive ---------- */
/* Small phones */
@media (max-width: 480px) {
.app-header {
padding: 6px 10px;
min-height: 48px;
}
.app-title {
font-size: 13px;
}
.round-display {
font-size: 12px;
}
.fullscreen-btn span,
.reset-btn span {
display: none;
}
.fullscreen-btn,
.reset-btn {
padding: 8px 10px;
}
.scoreboard {
padding: 10px 8px;
}
.team-panel {
padding: 14px 10px;
}
.round-tile {
min-width: 52px;
padding: 5px 8px;
font-size: 12px;
}
}
/* Large screens / tablets */
@media (min-width: 768px) {
.app-header {
padding: 12px 32px;
min-height: 72px;
}
.scoreboard {
padding: 32px 48px;
}
.round-history {
padding: 12px 24px;
}
.round-tile {
min-width: 72px;
padding: 8px 14px;
font-size: 14px;
}
}
/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
.app-header {
min-height: 40px;
padding: 4px 16px;
}
.round-display {
font-size: 14px;
}
.scoreboard {
padding: 8px;
gap: 0;
}
.team-panel {
padding: 10px 8px;
}
.round-history {
padding: 4px 8px;
}
.round-tile {
min-width: 48px;
padding: 3px 6px;
font-size: 11px;
}
}
/* ---------- Prefers reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
:root {
--transition-speed: 0.01s;
}
.flash-red,
.flash-green {
animation-duration: 0.1s;
}
.rounds-list {
scroll-behavior: auto;
}
}