Align web client with pygame table

This commit is contained in:
2026-07-14 20:28:47 +09:00
parent ef4b9d82b0
commit 891cc113f0
5 changed files with 642 additions and 215 deletions
+69 -62
View File
@@ -2,7 +2,7 @@ import { useEffect, useMemo, useRef, useState } from "react";
import { Board } from "./components/Board";
import { Card, CardBack } from "./components/Card";
import { COLOR_NAMES, cardColor, cardName } from "./game/cards";
import { cardColor, cardName } from "./game/cards";
import {
boardScore,
currentHandSorted,
@@ -22,8 +22,9 @@ function App() {
const [history, setHistory] = useState<GameState[]>([]);
const [selection, setSelection] = useState<Selection>(EMPTY_SELECTION);
const [policy, setPolicy] = useState<Policy | null>(null);
const [modelMessage, setModelMessage] = useState("모델 로딩 중…");
const [modelMessage, setModelMessage] = useState("LOADING FINAL PPO");
const [thinking, setThinking] = useState(false);
const [menuOpen, setMenuOpen] = useState(false);
const generation = useRef(0);
const scores = useMemo(() => boardScore(state), [state]);
@@ -36,7 +37,7 @@ function App() {
loadPolicy().then(({ policy: loaded, warning }) => {
if (cancelled) return;
setPolicy(loaded);
setModelMessage(warning ?? `${loaded.provider.toUpperCase()} · ON-DEVICE`);
setModelMessage(warning ?? `${loaded.provider.toUpperCase()} · FINAL PPO`);
});
return () => { cancelled = true; };
}, []);
@@ -57,7 +58,7 @@ function App() {
} finally {
if (generation.current === currentGeneration) setThinking(false);
}
}, 420);
}, 620);
return () => window.clearTimeout(timer);
}, [policy, state]);
@@ -67,6 +68,7 @@ function App() {
setHistory([]);
setSelection(EMPTY_SELECTION);
setThinking(false);
setMenuOpen(false);
}
function undoTurn() {
@@ -78,11 +80,12 @@ function App() {
setHistory(history.slice(0, index));
setSelection(EMPTY_SELECTION);
setThinking(false);
setMenuOpen(false);
}
function chooseCard(handSlot: number) {
if (state.toMove !== 0 || state.done) return;
setSelection({ handSlot, placeType: null });
setSelection((current) => current.handSlot === handSlot ? EMPTY_SELECTION : { handSlot, placeType: null });
}
function choosePlace(placeType: PlaceType) {
@@ -104,38 +107,66 @@ function App() {
}
const selectedCard = selection.handSlot === null ? null : humanHand[selection.handSlot];
const selectedColor = selectedCard === null ? null : cardColor(selectedCard);
const canPlaySelected = selection.handSlot !== null && Array.from(
{ length: 6 },
(_, draw) => legal[encodeAction(selection.handSlot!, PLAY, draw)],
).some(Boolean);
const status = state.done
? scores[0] === scores[1] ? "DRAW" : scores[0] > scores[1] ? "YOU WIN" : "AI WINS"
: state.toMove === 1 ? thinking ? "AI THINKING" : "AI TURN" : "YOUR TURN";
? scores[0] === scores[1] ? "DRAW" : scores[0] > scores[1] ? "YOU WIN" : "THE RIVAL WINS"
: state.toMove === 1 ? thinking ? "The rival is thinking ···" : "The rival's turn"
: selection.handSlot === null ? "Play or discard a card"
: selection.placeType === null ? `Choose a destination for ${cardName(selectedCard!)}`
: "Draw — deck or a discard pile";
return (
<main className="app-shell">
<header className="topbar">
<div>
<p className="eyebrow">COOLRL / CLASSIC</p>
<h1>LOST CITIES</h1>
</div>
<div className="topbar__status">
<span className={`status-dot ${thinking ? "status-dot--pulse" : ""}`} />
<div><strong>{status}</strong><small>{modelMessage}</small></div>
</div>
<div className="topbar__actions">
<button className="text-button" onClick={undoTurn} disabled={!history.length}>UNDO</button>
<button className="primary-button" onClick={restart}>NEW GAME</button>
</div>
</header>
<section className="opponent-strip">
<div className="player-label"><span>AI</span><b>{scores[1]}</b></div>
<div className="hidden-hand">{opponentHand.map((card) => <CardBack key={card} />)}</div>
<div className="deck-meter"><span>DECK</span><strong>{N_CARDS - state.drawPtr}</strong></div>
<section className="score-plaque score-plaque--rival" aria-label={`Rival score ${scores[1]}`}>
<div><strong>THE RIVAL</strong><small>{modelMessage}</small></div><b>{scores[1]}</b>
</section>
<Board state={state} />
<div className="opponent-hand" aria-label="Rival hand">
{opponentHand.map((card) => <CardBack key={card} />)}
</div>
<section className="control-deck">
<div className="player-label"><span>YOU</span><b>{scores[0]}</b></div>
<div className="hand" aria-label="Your hand">
<div className="menu-wrap">
<button className="menu-button" onClick={() => setMenuOpen((open) => !open)}>MENU</button>
{menuOpen && (
<div className="menu-popover">
<button onClick={restart}>NEW GAME</button>
<button onClick={undoTurn} disabled={!history.length}>UNDO TURN</button>
<span>{policy ? `${policy.provider.toUpperCase()} POLICY` : "LOADING POLICY"}</span>
</div>
)}
</div>
<div className="table-center">
<Board
state={state}
selectedColor={selectedColor}
selectedPlace={selection.placeType}
canPlay={canPlaySelected}
canDraw={legalDraw}
onChoosePlace={choosePlace}
onDraw={commit}
/>
</div>
<button
type="button"
className={`deck-stack ${legalDraw(DRAW_DECK) ? "is-draw-target" : ""}`}
disabled={!legalDraw(DRAW_DECK)}
onClick={() => commit(DRAW_DECK)}
aria-label={`Draw from deck, ${N_CARDS - state.drawPtr} cards left`}
>
<CardBack />
<strong>{N_CARDS - state.drawPtr}</strong>
<span>CARDS LEFT</span>
</button>
<p className={`turn-prompt ${thinking ? "turn-prompt--thinking" : ""}`}>{status}</p>
<section className="human-hand" aria-label="Your hand">
{humanHand.map((card, index) => (
<Card
card={card}
@@ -145,42 +176,18 @@ function App() {
onClick={() => chooseCard(index)}
/>
))}
</div>
<div className="decision-panel">
<div className="decision-panel__step">
<span>01</span><p>{selectedCard === null ? "SELECT A CARD" : cardName(selectedCard)}</p>
</div>
<div className="decision-panel__buttons">
<button
className={selection.placeType === PLAY ? "active" : ""}
disabled={selection.handSlot === null || !Array.from({ length: 6 }, (_, draw) => legal[encodeAction(selection.handSlot!, PLAY, draw)]).some(Boolean)}
onClick={() => choosePlace(PLAY)}
>PLAY</button>
<button
className={selection.placeType === DISCARD ? "active" : ""}
disabled={selection.handSlot === null}
onClick={() => choosePlace(DISCARD)}
>DISCARD</button>
</div>
<div className="decision-panel__step"><span>02</span><p>CHOOSE DRAW</p></div>
<div className="draw-buttons">
<button disabled={!legalDraw(DRAW_DECK)} onClick={() => commit(DRAW_DECK)}>DECK</button>
{COLOR_NAMES.map((name, color) => (
<button
key={name}
className={`draw-color draw-color--${color}`}
disabled={!legalDraw(color + 1)}
onClick={() => commit(color + 1)}
title={`Draw from ${name} discard pile`}
><span style={{ background: `var(--color-${color})` }} />{name.slice(0, 1)}</button>
))}
</div>
</div>
</section>
<section className="score-plaque score-plaque--human" aria-label={`Your score ${scores[0]}`}>
<div><strong>YOU <i /></strong><small>{state.toMove === 0 && !state.done ? "YOUR TURN" : "EXPEDITION LEAD"}</small></div><b>{scores[0]}</b>
</section>
{state.done && (
<div className="result-overlay">
<div className="result-card"><p>ROUND COMPLETE</p><h2>{status}</h2><strong>{scores[0]} <i>:</i> {scores[1]}</strong><button onClick={restart}>PLAY AGAIN</button></div>
<div className="result-card">
<p>ROUND COMPLETE</p><h1>{status}</h1><strong>{scores[0]} <i>:</i> {scores[1]}</strong>
<button onClick={restart}>PLAY AGAIN</button>
</div>
</div>
)}
</main>
+79 -15
View File
@@ -1,31 +1,95 @@
import { Card } from "./Card";
import { COLOR_HEX, COLOR_NAMES } from "../game/cards";
import {
COLOR_GLYPHS,
COLOR_HEX,
EXPEDITION_NAMES,
cardRank,
isHandshake,
} from "../game/cards";
import { cardsOnBoard } from "../game/engine";
import type { GameState } from "../game/types";
import { DISCARD, PLAY, type GameState, type PlaceType } from "../game/types";
export function Board({ state }: { state: GameState }) {
interface BoardProps {
state: GameState;
selectedColor: number | null;
selectedPlace: PlaceType | null;
canPlay: boolean;
canDraw: (source: number) => boolean;
onChoosePlace: (place: PlaceType) => void;
onDraw: (source: number) => void;
}
function expeditionScore(cards: number[]): string | null {
if (!cards.length) return null;
const handshakes = cards.filter(isHandshake).length;
const ranks = cards.reduce((sum, card) => sum + cardRank(card), 0);
const score = (ranks - 20) * (1 + handshakes) + (cards.length >= 8 ? 20 : 0);
return `${score >= 0 ? "+" : ""}${score}${handshakes ? ` ×${handshakes + 1}` : ""}`;
}
export function Board({
state,
selectedColor,
selectedPlace,
canPlay,
canDraw,
onChoosePlace,
onDraw,
}: BoardProps) {
return (
<section className="board" aria-label="Expeditions and discard piles">
{COLOR_NAMES.map((name, color) => {
{EXPEDITION_NAMES.map((name, color) => {
const opponent = cardsOnBoard(state, 1, color);
const mine = cardsOnBoard(state, 0, color);
const discard = state.piles[color];
const playTarget = selectedColor === color && selectedPlace === null && canPlay;
const discardTarget = selectedColor === color && selectedPlace === null;
const drawTarget = selectedPlace !== null && canDraw(color + 1);
return (
<article className="lane" key={name} style={{ "--lane-color": COLOR_HEX[color] } as React.CSSProperties}>
<header className="lane__header">
<span className="lane__dot" />
<span>{name}</span>
</header>
<article
className="lane"
key={name}
style={{ "--lane-color": COLOR_HEX[color] } as React.CSSProperties}
>
<div className="lane__zone lane__zone--opponent">
{opponent.length ? opponent.map((card) => <Card compact card={card} key={card} />) : <span className="lane__empty">AI</span>}
{opponent.length ? (
<div className="card-stack card-stack--opponent">
{opponent.map((card) => <Card compact card={card} key={card} />)}
</div>
<div className="lane__discard">
{discard.length ? <Card compact card={discard.at(-1)!} /> : <span>DISCARD</span>}
{discard.length > 1 && <b>+{discard.length - 1}</b>}
) : (
<span className="lane__ghost">{COLOR_GLYPHS[color]}</span>
)}
{expeditionScore(opponent) && <b className="score-chip">{expeditionScore(opponent)}</b>}
</div>
<div className="lane__zone lane__zone--mine">
{mine.length ? mine.map((card) => <Card compact card={card} key={card} />) : <span className="lane__empty">YOU</span>}
<button
type="button"
className={`lane__discard ${discardTarget ? "is-target" : ""} ${drawTarget ? "is-draw-target" : ""} ${selectedPlace === DISCARD && selectedColor === color ? "is-chosen" : ""}`}
onClick={() => drawTarget ? onDraw(color + 1) : discardTarget ? onChoosePlace(DISCARD) : undefined}
disabled={!discardTarget && !drawTarget}
aria-label={`${name} discard pile`}
>
{discard.length ? <Card compact card={discard.at(-1)!} /> : <span className="lane__ghost">{COLOR_GLYPHS[color]}</span>}
{discard.length > 1 && <b className="pile-count">×{discard.length}</b>}
</button>
<span className="lane__name">{name}</span>
<button
type="button"
className={`lane__zone lane__zone--mine ${playTarget ? "is-target" : ""} ${selectedPlace === PLAY && selectedColor === color ? "is-chosen" : ""}`}
onClick={() => playTarget ? onChoosePlace(PLAY) : undefined}
disabled={!playTarget}
aria-label={`Your ${name} expedition`}
>
{mine.length ? (
<div className="card-stack card-stack--mine">
{mine.map((card) => <Card compact card={card} key={card} />)}
</div>
) : (
<span className="lane__ghost">{COLOR_GLYPHS[color]}</span>
)}
{expeditionScore(mine) && <b className="score-chip">{expeditionScore(mine)}</b>}
</button>
</article>
);
})}
+33 -15
View File
@@ -1,4 +1,11 @@
import { COLOR_HEX, COLOR_NAMES, cardColor, cardValue } from "../game/cards";
import {
COLOR_GLYPHS,
COLOR_HEX,
COLOR_NAMES,
cardColor,
cardValue,
isHandshake,
} from "../game/cards";
interface CardProps {
card: number;
@@ -10,26 +17,37 @@ interface CardProps {
export function Card({ card, compact = false, selected = false, disabled = false, onClick }: CardProps) {
const color = cardColor(card);
return (
<button
type="button"
className={`card ${compact ? "card--compact" : ""} ${selected ? "card--selected" : ""}`}
style={{ "--card-color": COLOR_HEX[color] } as React.CSSProperties}
onClick={onClick}
disabled={disabled || !onClick}
aria-label={`${COLOR_NAMES[color]} ${cardValue(card)}`}
>
<span className="card__color">{COLOR_NAMES[color]}</span>
<span className="card__value">{cardValue(card)}</span>
<span className="card__mark">{cardValue(card)}</span>
</button>
const value = cardValue(card);
const handshake = isHandshake(card);
const className = `card ${compact ? "card--compact" : ""} ${selected ? "card--selected" : ""}`;
const style = { "--card-color": COLOR_HEX[color] } as React.CSSProperties;
const content = (
<>
<span className="card__corner card__corner--top">
<b>{value}</b><i>{COLOR_GLYPHS[color]}</i>
</span>
<span className={`card__center ${handshake ? "card__center--handshake" : ""}`}>
{handshake ? (
<><i>{COLOR_GLYPHS[color]}</i><small>HANDSHAKE</small></>
) : (
<><b>{value}</b><i>{COLOR_GLYPHS[color]}</i></>
)}
</span>
<span className="card__corner card__corner--bottom">
<b>{value}</b><i>{COLOR_GLYPHS[color]}</i>
</span>
</>
);
if (!onClick) {
return <div className={className} style={style} aria-label={`${COLOR_NAMES[color]} ${value}`}>{content}</div>;
}
return <button type="button" className={className} style={style} onClick={onClick} disabled={disabled} aria-label={`${COLOR_NAMES[color]} ${value}`}>{content}</button>;
}
export function CardBack({ count }: { count?: number }) {
return (
<div className="card card--back" aria-label={count === undefined ? "Hidden card" : `${count} cards`}>
<span className="card__back-mark">LC</span>
<span className="card__back-frame"><i></i></span>
{count !== undefined && <span className="card__count">{count}</span>}
</div>
);
+3 -1
View File
@@ -1,7 +1,9 @@
import { CARDS_PER_COLOR } from "./types";
export const COLOR_NAMES = ["Red", "Blue", "Green", "Gold", "Violet"] as const;
export const COLOR_HEX = ["#ff4e53", "#538df4", "#74ae52", "#e8b53b", "#a463ca"] as const;
export const EXPEDITION_NAMES = ["Volcano", "Ocean", "Jungle", "Desert", "Cavern"] as const;
export const COLOR_HEX = ["#b94737", "#3569a7", "#397b4e", "#b37d20", "#704487"] as const;
export const COLOR_GLYPHS = ["▲", "≋", "♧", "◆", "⬟"] as const;
export function cardColor(card: number): number {
return Math.floor(card / CARDS_PER_COLOR);
+448 -112
View File
@@ -1,125 +1,461 @@
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Inter:wght@400;500;600;700&display=swap");
:root {
color: #e7e7eb;
background: #050607;
font-family: Inter, system-ui, sans-serif;
color: #e8e5dc;
background: #101313;
font-family: Arial, Helvetica, sans-serif;
font-synthesis: none;
--muted: #8e9099;
--line: #292b30;
--panel: #0a0b0d;
--color-0: #ff4e53;
--color-1: #538df4;
--color-2: #74ae52;
--color-3: #e8b53b;
--color-4: #a463ca;
--gold: #c9a34b;
--gold-dim: #725e30;
--ink: #25241f;
--felt-top: #242829;
--felt-bottom: #111414;
--line: rgba(226, 220, 202, 0.16);
--ivory: #eee9dc;
--color-0: #b94737;
--color-1: #3569a7;
--color-2: #397b4e;
--color-3: #b37d20;
--color-4: #704487;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #050607; }
button { font: inherit; }
button:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
html, body, #root { min-width: 1024px; min-height: 100%; margin: 0; }
body { min-height: 100vh; overflow: hidden; background: #101313; }
button { color: inherit; font: inherit; }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.app-shell { min-height: 100vh; padding-bottom: 24px; background: radial-gradient(circle at 50% -20%, #1d2026 0, #090a0c 34%, #050607 64%); }
.topbar { height: 94px; padding: 16px 28px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; background: rgba(5, 6, 7, .9); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 20; }
.eyebrow { margin: 0 0 3px; color: var(--muted); font: 500 10px/1 IBM Plex Mono, monospace; letter-spacing: .16em; }
h1 { margin: 0; font: 600 25px/1 IBM Plex Mono, monospace; letter-spacing: -.04em; }
.topbar__status { display: flex; gap: 12px; align-items: center; min-width: 180px; }
.topbar__status div { display: flex; flex-direction: column; gap: 3px; }
.topbar__status strong { font: 600 12px/1.2 IBM Plex Mono, monospace; letter-spacing: .08em; }
.topbar__status small { color: var(--muted); font: 9px/1.2 IBM Plex Mono, monospace; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #70c48f; box-shadow: 0 0 16px #70c48f; }
.status-dot--pulse { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.75); } }
.topbar__actions { justify-self: end; display: flex; gap: 8px; }
.text-button, .primary-button { min-height: 38px; padding: 0 16px; border: 1px solid var(--line); color: #ddd; background: transparent; font: 600 10px IBM Plex Mono, monospace; letter-spacing: .08em; cursor: pointer; }
.primary-button { background: #ececf0; color: #08090a; border-color: #ececf0; }
.text-button:disabled { opacity: .3; cursor: default; }
.app-shell {
position: relative;
width: 100vw;
min-width: 1024px;
height: 100vh;
min-height: 720px;
overflow: hidden;
isolation: isolate;
background:
radial-gradient(ellipse at 50% 42%, rgba(51, 57, 57, 0.78) 0%, rgba(30, 34, 34, 0.66) 47%, transparent 72%),
linear-gradient(180deg, var(--felt-top), var(--felt-bottom));
}
.opponent-strip, .control-deck { width: min(1480px, calc(100% - 40px)); margin: 0 auto; display: grid; align-items: center; }
.opponent-strip { min-height: 116px; grid-template-columns: 100px 1fr 90px; border-bottom: 1px solid var(--line); }
.player-label { display: flex; align-items: baseline; gap: 10px; }
.player-label span { color: var(--muted); font: 500 10px IBM Plex Mono, monospace; letter-spacing: .15em; }
.player-label b { font: 500 26px IBM Plex Mono, monospace; }
.hidden-hand { display: flex; justify-content: center; height: 66px; }
.hidden-hand .card { margin-left: -20px; }
.hidden-hand .card:first-child { margin-left: 0; }
.deck-meter { justify-self: end; display: flex; flex-direction: column; align-items: flex-end; }
.deck-meter span { color: var(--muted); font: 9px IBM Plex Mono, monospace; }
.deck-meter strong { font: 500 24px IBM Plex Mono, monospace; }
.app-shell::before {
position: absolute;
inset: 0;
z-index: -1;
content: "";
pointer-events: none;
opacity: 0.42;
background-image:
repeating-radial-gradient(circle at 20% 30%, transparent 0 2px, rgba(255, 255, 255, 0.018) 3px, transparent 4px),
repeating-linear-gradient(97deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 4px);
mix-blend-mode: soft-light;
}
.board { width: min(1480px, calc(100% - 40px)); min-height: 445px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.lane { min-width: 0; border-right: 1px solid var(--line); display: grid; grid-template-rows: 34px 1fr 76px 1fr; background: linear-gradient(180deg, color-mix(in srgb, var(--lane-color) 3%, transparent), transparent 42%); }
.lane__header { display: flex; align-items: center; justify-content: center; gap: 7px; color: #bfc0c5; font: 500 9px IBM Plex Mono, monospace; letter-spacing: .12em; border-bottom: 1px solid #181a1e; }
.lane__dot { width: 5px; height: 5px; border-radius: 50%; background: var(--lane-color); box-shadow: 0 0 10px var(--lane-color); }
.lane__zone { min-height: 118px; padding: 12px; display: flex; justify-content: center; align-items: center; overflow: hidden; }
.lane__zone .card { margin-left: -35px; }
.lane__zone .card:first-of-type { margin-left: 0; }
.lane__zone--opponent { align-items: flex-start; }
.lane__zone--mine { align-items: flex-end; }
.lane__empty { color: #25272d; font: 600 10px IBM Plex Mono, monospace; }
.lane__discard { position: relative; display: flex; align-items: center; justify-content: center; border-top: 1px dashed #202228; border-bottom: 1px dashed #202228; color: #383b43; font: 500 8px IBM Plex Mono, monospace; }
.lane__discard b { position: absolute; margin: 0 0 -40px 50px; color: var(--muted); font: 9px IBM Plex Mono, monospace; }
.score-plaque {
position: absolute;
left: 24px;
z-index: 10;
width: 236px;
height: 64px;
padding: 10px 15px;
display: flex;
align-items: center;
justify-content: space-between;
border: 1px solid rgba(202, 190, 159, 0.22);
border-radius: 14px;
background: linear-gradient(145deg, rgba(8, 15, 14, 0.96), rgba(14, 24, 22, 0.94));
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}
.card { --card-color: #aaa; position: relative; flex: 0 0 auto; width: 74px; height: 96px; padding: 8px; border: 1px solid color-mix(in srgb, var(--card-color) 80%, #fff); border-radius: 3px; color: #e9e9ed; background: linear-gradient(145deg, color-mix(in srgb, var(--card-color) 10%, #0d0e11), #08090b 60%); box-shadow: 0 8px 20px rgba(0,0,0,.35); text-align: left; cursor: pointer; transition: transform .16s ease, border-color .16s, filter .16s; }
button.card:not(:disabled):hover { transform: translateY(-7px); filter: brightness(1.18); z-index: 4; }
.score-plaque--rival { top: 14px; }
.score-plaque--human { bottom: 14px; border-color: var(--gold); }
.score-plaque div { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.score-plaque strong {
color: #efeee9;
font: 700 14px/1 Arial, sans-serif;
letter-spacing: 0.2em;
}
.score-plaque small {
max-width: 155px;
overflow: hidden;
color: #858784;
font: 500 9px/1 Arial, sans-serif;
letter-spacing: 0.08em;
text-overflow: ellipsis;
white-space: nowrap;
}
.score-plaque > b { color: #e9e6dd; font: 700 30px/1 Georgia, serif; }
.score-plaque--human > b { color: var(--gold); }
.score-plaque i {
display: inline-block;
width: 6px;
height: 6px;
margin-left: 4px;
transform: rotate(45deg) translateY(-2px);
background: var(--gold);
}
.opponent-hand {
position: absolute;
top: 9px;
left: 50%;
z-index: 8;
height: 58px;
display: flex;
transform: translateX(-50%);
}
.opponent-hand .card { margin-left: -17px; }
.opponent-hand .card:first-child { margin-left: 0; }
.menu-wrap { position: absolute; top: 16px; right: 24px; z-index: 20; }
.menu-button {
width: 92px;
height: 39px;
border: 1px solid var(--gold-dim);
border-radius: 12px;
background: rgba(7, 13, 12, 0.9);
color: #e8e5dc;
font: 700 10px Arial, sans-serif;
letter-spacing: 0.18em;
cursor: pointer;
}
.menu-button:hover { border-color: var(--gold); }
.menu-popover {
position: absolute;
top: 47px;
right: 0;
width: 180px;
padding: 8px;
display: grid;
gap: 6px;
border: 1px solid rgba(201, 163, 75, 0.5);
border-radius: 10px;
background: rgba(8, 14, 13, 0.98);
box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}
.menu-popover button {
height: 36px;
border: 1px solid rgba(255, 255, 255, 0.1);
background: #111a18;
color: #ddd9ce;
font: 700 9px Arial, sans-serif;
letter-spacing: 0.12em;
cursor: pointer;
}
.menu-popover button:hover:not(:disabled) { border-color: var(--gold); }
.menu-popover button:disabled { opacity: 0.3; cursor: default; }
.menu-popover span { padding: 7px 4px 2px; color: #757a76; font: 8px Arial, sans-serif; letter-spacing: 0.08em; }
.table-center {
position: absolute;
top: 72px;
bottom: 242px;
left: 50%;
width: clamp(610px, 43vw, 690px);
transform: translateX(-50%);
}
.board {
width: 100%;
height: 100%;
display: grid;
grid-template-columns: repeat(5, minmax(0, 1fr));
}
.lane {
position: relative;
min-width: 0;
padding: 0 11px;
display: grid;
grid-template-rows: minmax(150px, 1fr) minmax(112px, 18%) 27px minmax(150px, 1fr);
border: 1px solid color-mix(in srgb, var(--lane-color) 35%, transparent);
border-radius: 8px;
background: linear-gradient(180deg, color-mix(in srgb, var(--lane-color) 10%, transparent), color-mix(in srgb, var(--lane-color) 3%, transparent));
}
.lane + .lane { margin-left: -2px; }
.lane__zone,
.lane__discard {
position: relative;
min-width: 0;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
border: 0;
background: transparent;
}
button.lane__zone,
button.lane__discard { width: 100%; cursor: default; }
button.lane__zone:disabled,
button.lane__discard:disabled { opacity: 1; }
.lane__zone--opponent { align-items: flex-start; padding-top: 0; }
.lane__zone--mine { align-items: flex-end; padding-bottom: 0; }
.lane__discard { align-self: center; }
.lane__name {
align-self: center;
color: rgba(226, 222, 211, 0.48);
font: 700 10px Arial, sans-serif;
letter-spacing: 0.2em;
text-align: center;
text-transform: uppercase;
}
.lane__ghost {
width: 88px;
height: 124px;
display: grid;
place-items: center;
border: 1px solid rgba(231, 226, 210, 0.18);
border-radius: 9px;
color: color-mix(in srgb, var(--lane-color) 35%, #787b77);
font: 42px/1 Georgia, serif;
opacity: 0.45;
}
.lane__discard .lane__ghost { height: 122px; }
.card-stack {
position: relative;
width: 88px;
max-height: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.card-stack .card + .card { margin-top: -94px; }
.card-stack--opponent { justify-content: flex-start; }
.card-stack--mine { justify-content: flex-end; }
.score-chip {
position: absolute;
z-index: 9;
min-width: 42px;
padding: 5px 8px;
border: 1px solid var(--gold-dim);
border-radius: 10px;
background: #0c1513;
color: #ddd8ca;
font: 700 10px Arial, sans-serif;
text-align: center;
}
.lane__zone--opponent .score-chip { top: -5px; right: -5px; }
.lane__zone--mine .score-chip { right: -5px; bottom: -5px; }
.pile-count {
position: absolute;
right: 1px;
bottom: 4px;
z-index: 8;
padding: 4px 7px;
border: 1px solid var(--gold-dim);
border-radius: 9px;
background: #0b1211;
color: #c8c0aa;
font: 700 10px Arial, sans-serif;
}
.lane__zone.is-target,
.lane__discard.is-target,
.lane__discard.is-draw-target,
.deck-stack.is-draw-target {
cursor: pointer;
animation: target-pulse 1.3s ease-in-out infinite;
}
.lane__zone.is-target .lane__ghost,
.lane__discard.is-target .lane__ghost,
.lane__discard.is-draw-target .lane__ghost,
.lane__zone.is-chosen .lane__ghost,
.lane__discard.is-chosen .lane__ghost {
border-color: var(--gold);
box-shadow: 0 0 0 2px rgba(201, 163, 75, 0.12), 0 0 30px color-mix(in srgb, var(--lane-color) 30%, transparent);
opacity: 0.85;
}
.lane__zone.is-target .card,
.lane__discard.is-target .card,
.lane__discard.is-draw-target .card,
.lane__zone.is-chosen .card,
.lane__discard.is-chosen .card { box-shadow: 0 0 0 2px var(--gold), 0 0 28px rgba(201, 163, 75, 0.25); }
@keyframes target-pulse { 50% { filter: brightness(1.22); } }
.card {
--card-color: #888;
position: relative;
flex: 0 0 auto;
width: 116px;
height: 160px;
padding: 0;
overflow: hidden;
border: 2px solid color-mix(in srgb, var(--card-color) 78%, #4c483d);
border-radius: 11px;
background: linear-gradient(145deg, #f4efe3, var(--ivory));
box-shadow: 0 8px 18px rgba(0, 0, 0, 0.38), inset 0 0 0 4px rgba(255, 255, 255, 0.35);
color: var(--card-color);
text-align: left;
transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
button.card { cursor: pointer; }
button.card:not(:disabled):hover { z-index: 10; transform: translateY(-14px); filter: brightness(1.04); }
button.card:disabled { cursor: default; }
.card--selected { transform: translateY(-10px); border-width: 2px; box-shadow: 0 0 24px color-mix(in srgb, var(--card-color) 25%, transparent); }
.card__color { color: var(--card-color); font: 500 7px IBM Plex Mono, monospace; letter-spacing: .08em; text-transform: uppercase; }
.card__value { display: block; margin-top: 11px; font: 500 28px/1 IBM Plex Mono, monospace; }
.card__mark { position: absolute; right: 7px; bottom: 7px; color: color-mix(in srgb, var(--card-color) 30%, #15171b); font: 600 22px IBM Plex Mono, monospace; }
.card--compact { width: 52px; height: 67px; padding: 5px; cursor: default; }
.card--compact .card__value { margin-top: 6px; font-size: 18px; }
.card--compact .card__color { display: none; }
.card--compact .card__mark { font-size: 13px; }
.card--back { width: 48px; height: 64px; display: grid; place-items: center; border-color: #3c3f47; color: #555962; background: repeating-linear-gradient(135deg, #101217, #101217 4px, #0a0b0e 4px, #0a0b0e 8px); cursor: default; }
.card__back-mark { font: 600 10px IBM Plex Mono, monospace; letter-spacing: .1em; }
.card__count { position: absolute; bottom: 3px; right: 5px; font: 8px IBM Plex Mono, monospace; }
.control-deck { grid-template-columns: 100px minmax(500px, 1fr) 370px; gap: 20px; min-height: 188px; padding-top: 20px; }
.control-deck > .player-label { align-self: start; padding-top: 22px; }
.hand { display: flex; align-items: flex-end; justify-content: center; min-width: 0; padding: 18px 4px; }
.hand .card { margin-left: -10px; }
.hand .card:first-child { margin-left: 0; }
.decision-panel { border: 1px solid var(--line); background: rgba(11,12,15,.78); padding: 13px; }
.decision-panel__step { display: flex; align-items: center; gap: 9px; }
.decision-panel__step span { color: #51545c; font: 9px IBM Plex Mono, monospace; }
.decision-panel__step p { margin: 0; color: #b8bac0; font: 500 9px IBM Plex Mono, monospace; letter-spacing: .08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.decision-panel__buttons, .draw-buttons { display: grid; gap: 6px; margin: 9px 0 12px; }
.decision-panel__buttons { grid-template-columns: 1fr 1fr; }
.draw-buttons { grid-template-columns: 1.4fr repeat(5, 1fr); margin-bottom: 0; }
.decision-panel button { height: 34px; border: 1px solid #30323a; color: #bec0c6; background: #111318; font: 600 9px IBM Plex Mono, monospace; cursor: pointer; }
.decision-panel button:hover:not(:disabled), .decision-panel button.active { border-color: #bbbcc2; color: #fff; background: #1b1d22; }
.decision-panel button:disabled { opacity: .22; cursor: default; }
.draw-color span { display: inline-block; width: 5px; height: 5px; margin-right: 4px; border-radius: 50%; }
.result-overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(0,0,0,.72); backdrop-filter: blur(8px); }
.result-card { width: min(430px, calc(100% - 40px)); padding: 42px; border: 1px solid #40434b; background: #090a0c; text-align: center; }
.result-card p { color: var(--muted); font: 9px IBM Plex Mono, monospace; letter-spacing: .18em; }
.result-card h2 { margin: 14px; font: 600 34px IBM Plex Mono, monospace; }
.result-card strong { display: block; margin: 24px; font: 500 26px IBM Plex Mono, monospace; }
.result-card i { color: #4c4f57; font-style: normal; }
.result-card button { height: 42px; padding: 0 26px; border: 0; background: #eeeef1; color: #090a0c; font: 600 10px IBM Plex Mono, monospace; cursor: pointer; }
@media (max-width: 960px) {
.topbar { grid-template-columns: 1fr auto; }
.topbar__status { order: 3; grid-column: 1 / -1; min-width: 0; margin-top: 8px; }
.topbar { height: auto; }
.board { overflow-x: auto; grid-template-columns: repeat(5, minmax(160px, 1fr)); }
.control-deck { grid-template-columns: 70px 1fr; }
.decision-panel { grid-column: 1 / -1; }
.card--selected {
z-index: 11;
transform: translateY(-24px);
box-shadow: 0 0 0 3px var(--gold), 0 12px 28px rgba(0, 0, 0, 0.45), 0 0 34px rgba(201, 163, 75, 0.28);
}
.card__corner {
position: absolute;
left: 8px;
display: flex;
flex-direction: column;
align-items: center;
color: var(--card-color);
font-family: Georgia, serif;
}
.card__corner--top { top: 7px; }
.card__corner--bottom { right: 8px; bottom: 7px; left: auto; }
.card__corner b { font-size: 18px; line-height: 1; }
.card__corner i { margin-top: 1px; font-size: 12px; font-style: normal; line-height: 1; }
.card__center {
position: absolute;
inset: 24px 14px;
display: grid;
place-content: center;
justify-items: center;
color: var(--card-color);
font-family: Georgia, serif;
}
.card__center b { font-size: 48px; font-weight: 700; line-height: 0.9; }
.card__center i { margin-top: 6px; font-size: 27px; font-style: normal; line-height: 1; }
.card__center--handshake i { font-size: 44px; }
.card__center small { margin-top: 8px; font: 700 8px Arial, sans-serif; letter-spacing: 0.14em; }
.card::after {
position: absolute;
inset: 5px;
border: 1px solid color-mix(in srgb, var(--card-color) 28%, transparent);
border-radius: 7px;
content: "";
pointer-events: none;
}
@media (max-width: 620px) {
.topbar { padding: 14px; }
h1 { font-size: 20px; }
.text-button { display: none; }
.opponent-strip, .board, .control-deck { width: calc(100% - 20px); }
.opponent-strip { grid-template-columns: 70px 1fr 52px; }
.hidden-hand .card:nth-child(-n+3) { display: none; }
.control-deck { display: block; }
.control-deck > .player-label { padding: 10px 0 0; }
.hand { justify-content: flex-start; overflow-x: auto; padding: 16px 4px 24px; }
.hand .card { margin-left: -5px; }
.decision-panel { position: sticky; bottom: 8px; z-index: 10; }
.card--compact { width: 88px; height: 124px; border-radius: 9px; }
.card--compact .card__corner { left: 6px; }
.card--compact .card__corner--bottom { right: 6px; left: auto; }
.card--compact .card__corner b { font-size: 14px; }
.card--compact .card__corner i { font-size: 9px; }
.card--compact .card__center b { font-size: 34px; }
.card--compact .card__center i { font-size: 20px; }
.card--compact .card__center--handshake i { font-size: 31px; }
.card--compact .card__center small { font-size: 6px; }
.card--back {
width: 44px;
height: 58px;
padding: 4px;
display: grid;
place-items: center;
border: 2px solid #67552d;
border-radius: 5px;
background: repeating-linear-gradient(135deg, #20252a 0 5px, #181c20 5px 10px);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4), inset 0 0 0 3px #171b1e;
color: var(--gold);
}
.card--back::after { inset: 5px; border-color: rgba(201, 163, 75, 0.62); border-radius: 3px; }
.card__back-frame {
width: 26px;
height: 26px;
display: grid;
place-items: center;
border: 1px solid var(--gold-dim);
border-radius: 50%;
}
.card__back-frame i { font: 18px/1 Georgia, serif; font-style: normal; }
.card__count { position: absolute; right: 4px; bottom: 2px; font: 8px Arial, sans-serif; }
.deck-stack {
position: absolute;
top: 35%;
right: 4.4%;
z-index: 7;
width: 150px;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
border: 0;
background: transparent;
}
.deck-stack:disabled { opacity: 1; }
.deck-stack .card--back { width: 88px; height: 122px; border-radius: 9px; box-shadow: 7px 8px 0 #171b1e, 12px 14px 25px rgba(0, 0, 0, 0.48), inset 0 0 0 5px #171b1e; }
.deck-stack .card__back-frame { width: 56px; height: 56px; }
.deck-stack .card__back-frame i { font-size: 38px; }
.deck-stack strong { margin-top: 16px; color: #eee9de; font: 700 31px/1 Georgia, serif; }
.deck-stack > span { margin-top: 5px; color: #7e817c; font: 700 9px Arial, sans-serif; letter-spacing: 0.2em; }
.deck-stack.is-draw-target .card { box-shadow: 0 0 0 3px var(--gold), 7px 8px 0 #171b1e, 0 0 32px rgba(201, 163, 75, 0.3); }
.turn-prompt {
position: absolute;
right: 260px;
bottom: 202px;
left: 260px;
z-index: 7;
margin: 0;
overflow: hidden;
color: #dedbd3;
font: 16px/1.2 Arial, sans-serif;
text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
}
.turn-prompt--thinking { color: #c6b887; }
.human-hand {
position: absolute;
bottom: 30px;
left: 50%;
z-index: 8;
height: 164px;
display: flex;
align-items: flex-end;
justify-content: center;
transform: translateX(-50%);
}
.human-hand .card { margin-left: 12px; }
.human-hand .card:first-child { margin-left: 0; }
.result-overlay {
position: fixed;
inset: 0;
z-index: 40;
display: grid;
place-items: center;
background: rgba(4, 8, 7, 0.78);
backdrop-filter: blur(10px);
}
.result-card {
width: min(430px, calc(100% - 40px));
padding: 42px;
border: 1px solid var(--gold-dim);
border-radius: 18px;
background: #0b1211;
text-align: center;
}
.result-card p { color: #8d8d84; font: 700 9px Arial, sans-serif; letter-spacing: 0.2em; }
.result-card h1 { margin: 16px 0; color: #eee9dd; font: 700 34px Georgia, serif; }
.result-card strong { display: block; margin: 24px; color: var(--gold); font: 700 28px Georgia, serif; }
.result-card i { color: #716b5b; font-style: normal; }
.result-card button { height: 42px; padding: 0 28px; border: 1px solid var(--gold); border-radius: 10px; background: transparent; color: #ece8dc; font: 700 10px Arial, sans-serif; letter-spacing: 0.12em; cursor: pointer; }
@media (max-width: 1250px) {
.table-center { width: 600px; }
.lane { padding: 0 7px; }
.lane__ghost, .card--compact { width: 78px; height: 110px; }
.human-hand .card { width: 98px; height: 142px; margin-left: 7px; }
.human-hand { height: 146px; }
.turn-prompt { bottom: 177px; }
.table-center { bottom: 210px; }
.score-plaque { width: 210px; }
}
@media (max-height: 820px) {
.score-plaque { height: 54px; }
.score-plaque--rival { top: 9px; }
.opponent-hand { top: 5px; transform: translateX(-50%) scale(0.86); transform-origin: top center; }
.table-center { top: 64px; bottom: 196px; }
.human-hand { bottom: 18px; height: 138px; }
.human-hand .card { width: 94px; height: 134px; }
.turn-prompt { bottom: 165px; }
.score-plaque--human { bottom: 9px; }
.deck-stack { transform: scale(0.86); }
}