Add Sycamore/WASM frontend and restructure into server/ + web/
Repo is now a monorepo:
- server/: the kaya backend, unchanged in behaviour, plus:
- GET /api/me for SPA session detection
- last_move recorded on every play and broadcast in the game state, so
clients can show who played which card the moment they play it
- legal_moves per hand card for the player on turn (rules stay
server-side)
- static catch-all route serving the compiled SPA with index.html
fallback; Tortoise context now bound only for /api/* requests
- configurable OIDC post-login/logout redirects for dev against trunk
- web/: Sycamore 0.9 + WASM frontend (trunk): login via the OIDC flow,
lobby (create match / join by code), live game page over websocket with
card images (CC0 woodcut napoletane deck), capture picker, move banner,
game-over overlay, match history and leaderboard pages
- server/Dockerfile gains a rust+trunk stage building web/dist; the single
app image serves the SPA; compose builds from the repo root with
overridable ports/OIDC env
Verified end-to-end against the compose stack: four OIDC logins, game
creation, three joins by code, websocket play with broadcasts to all
players and out-of-turn rejection. 51 backend tests, mypy and cargo tests
all green.
This commit is contained in:
+430
@@ -0,0 +1,430 @@
|
||||
/* Scopone scientifico frontend — dark table-felt theme. */
|
||||
|
||||
:root {
|
||||
--felt: #1d5c38;
|
||||
--felt-dark: #14341f;
|
||||
--panel: #223026;
|
||||
--panel-light: #2e4234;
|
||||
--text: #f1f0e8;
|
||||
--muted: #a9b7ab;
|
||||
--accent: #e8c547;
|
||||
--danger: #d9534f;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: "Segoe UI", system-ui, sans-serif;
|
||||
background: var(--felt-dark);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.app {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* ---------- shared chrome ---------- */
|
||||
|
||||
.top-nav {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
align-items: center;
|
||||
padding: 0.75rem 1rem;
|
||||
background: rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
.top-nav a {
|
||||
color: var(--accent);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.whoami {
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.panel {
|
||||
background: var(--panel);
|
||||
border-radius: 12px;
|
||||
padding: 1.25rem 1.5rem;
|
||||
margin: 1rem;
|
||||
}
|
||||
|
||||
.button {
|
||||
display: inline-block;
|
||||
background: var(--panel-light);
|
||||
color: var(--text);
|
||||
border: 1px solid #4c6a54;
|
||||
border-radius: 8px;
|
||||
padding: 0.55rem 1.1rem;
|
||||
margin: 0.25rem 0.25rem 0.25rem 0;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.button.primary {
|
||||
background: var(--accent);
|
||||
border-color: var(--accent);
|
||||
color: #1d1d1d;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
filter: brightness(1.15);
|
||||
}
|
||||
|
||||
.status {
|
||||
color: var(--muted);
|
||||
text-align: center;
|
||||
margin: 2rem;
|
||||
}
|
||||
|
||||
.toast {
|
||||
position: fixed;
|
||||
top: 1rem;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
background: var(--danger);
|
||||
color: #fff;
|
||||
padding: 0.6rem 1.2rem;
|
||||
border-radius: 8px;
|
||||
z-index: 30;
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
/* ---------- lobby / pages ---------- */
|
||||
|
||||
.lobby h1,
|
||||
.page h1 {
|
||||
text-align: center;
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
.lobby-grid,
|
||||
.page {
|
||||
max-width: 720px;
|
||||
margin: 0 auto;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.login-panel {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.target-buttons {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.join-form {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.join-form input {
|
||||
flex: 1;
|
||||
font-size: 1.2rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.3em;
|
||||
padding: 0.5rem;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #4c6a54;
|
||||
background: var(--panel-light);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.join-code {
|
||||
font-size: 2.4rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.35em;
|
||||
color: var(--accent);
|
||||
text-align: center;
|
||||
margin: 0.5rem 0;
|
||||
}
|
||||
|
||||
.status-panel {
|
||||
max-width: 520px;
|
||||
margin: 3rem auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.roster {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table.matches {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin: 1rem;
|
||||
}
|
||||
|
||||
table.matches th,
|
||||
table.matches td {
|
||||
padding: 0.5rem 0.75rem;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid #3c5543;
|
||||
}
|
||||
|
||||
table.matches td.won {
|
||||
color: #8bc34a;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
table.matches td.lost {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
/* ---------- game table ---------- */
|
||||
|
||||
.hud {
|
||||
display: flex;
|
||||
gap: 1.5rem;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0.6rem 1rem;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.hud a {
|
||||
color: var(--accent);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.hud-scores {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.turn-note {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.turn-note.you {
|
||||
color: var(--accent);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.table-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.table-grid {
|
||||
flex: 1;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 2.4fr 1fr;
|
||||
grid-template-rows: auto 1fr auto;
|
||||
grid-template-areas:
|
||||
". top ."
|
||||
"left center right"
|
||||
"bottom bottom bottom";
|
||||
gap: 0.5rem;
|
||||
padding: 0.75rem;
|
||||
}
|
||||
|
||||
.seat-top {
|
||||
grid-area: top;
|
||||
}
|
||||
|
||||
.seat-left {
|
||||
grid-area: left;
|
||||
}
|
||||
|
||||
.seat-right {
|
||||
grid-area: right;
|
||||
}
|
||||
|
||||
.seat-bottom {
|
||||
grid-area: bottom;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.seat {
|
||||
background: var(--panel);
|
||||
border: 2px solid transparent;
|
||||
border-radius: 10px;
|
||||
padding: 0.5rem 0.75rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.seat.active {
|
||||
border-color: var(--accent);
|
||||
box-shadow: 0 0 12px rgba(232, 197, 71, 0.45);
|
||||
}
|
||||
|
||||
.seat-name {
|
||||
font-weight: 600;
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.team-badge {
|
||||
font-size: 0.7rem;
|
||||
background: var(--panel-light);
|
||||
border-radius: 4px;
|
||||
padding: 0.1rem 0.35rem;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.seat-stats {
|
||||
font-size: 0.8rem;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.center {
|
||||
grid-area: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.table-cards {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.4rem;
|
||||
justify-content: center;
|
||||
min-height: 90px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.table-empty {
|
||||
color: var(--muted);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* ---------- cards ---------- */
|
||||
|
||||
.card-img {
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
|
||||
background: #fff;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.card-img.mini {
|
||||
height: 46px;
|
||||
}
|
||||
|
||||
.card-img.move-card {
|
||||
height: 54px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.card-img.table-card {
|
||||
height: 84px;
|
||||
}
|
||||
|
||||
.card-img.hand-card {
|
||||
height: 120px;
|
||||
}
|
||||
|
||||
.hand {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.hand-slot {
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 0;
|
||||
cursor: pointer;
|
||||
transition: transform 0.1s ease;
|
||||
}
|
||||
|
||||
.hand-slot:hover {
|
||||
transform: translateY(-8px);
|
||||
}
|
||||
|
||||
.hand-slot.selected {
|
||||
outline: 3px solid var(--accent);
|
||||
border-radius: 8px;
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
|
||||
.hint {
|
||||
color: var(--muted);
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
/* ---------- move banner ---------- */
|
||||
|
||||
.move-banner {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
background: rgba(0, 0, 0, 0.35);
|
||||
border-radius: 999px;
|
||||
padding: 0.35rem 1rem;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.scopa-badge {
|
||||
background: var(--accent);
|
||||
color: #1d1d1d;
|
||||
font-weight: 700;
|
||||
border-radius: 999px;
|
||||
padding: 0.15rem 0.6rem;
|
||||
margin-left: 0.25rem;
|
||||
}
|
||||
|
||||
/* ---------- overlays ---------- */
|
||||
|
||||
.overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0, 0, 0, 0.65);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 20;
|
||||
}
|
||||
|
||||
.picker {
|
||||
background: var(--panel);
|
||||
border-radius: 14px;
|
||||
padding: 1.5rem 2rem;
|
||||
text-align: center;
|
||||
min-width: 320px;
|
||||
}
|
||||
|
||||
.capture-options {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
margin: 1rem 0;
|
||||
}
|
||||
|
||||
.capture-option {
|
||||
background: var(--panel-light);
|
||||
border: 1px solid #4c6a54;
|
||||
border-radius: 10px;
|
||||
padding: 0.4rem;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
gap: 0.4rem;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.capture-option:hover {
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
.gameover-actions {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
justify-content: center;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
Reference in New Issue
Block a user