rewrite: TS monorepo — pi SDK stateless agents, Postgres+pg-boss, SvelteKit themed UI; legacy moved to legacy/

This commit is contained in:
ai-chess
2026-10-18 15:32:39 +03:00
parent e23a07f07b
commit 5be4bd1da4
321 changed files with 37840 additions and 158 deletions
+358
View File
@@ -0,0 +1,358 @@
/* ВЕЧЕРНИЙ МАТ — tabloid tokens */
:root {
--paper: #efe6cf;
--paper-2: #e4d9bc;
--paper-3: #d8cba9;
--ink: #15120f;
--ink-2: #4a4238;
--ink-3: #857a69;
--red: #d1231c;
--red-2: #a3140f;
--yellow: #ffd41c;
--white: #fbf7ec;
--green: #2d7a3a;
--blue: #1f5fae;
--f-head: 'Oswald', 'Arial Narrow', sans-serif;
--f-body: 'Spectral', Georgia, serif;
--f-mono: 'IBM Plex Mono', Menlo, monospace;
--rule: 2px solid var(--ink);
--rule-thin: 1px solid var(--ink);
--hard: 4px 4px 0 var(--ink);
--max-w: 1400px;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
html {
background: var(--paper-3);
}
body {
margin: 0;
min-height: 100vh;
color: var(--ink);
font-family: var(--f-body);
font-size: 15px;
line-height: 1.45;
background-color: var(--paper);
background-image:
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .14 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
linear-gradient(180deg, #f3ecd8 0%, var(--paper) 30%, #e9dfc6 100%);
background-attachment: fixed;
-webkit-font-smoothing: antialiased;
}
a {
color: inherit;
text-decoration: none;
}
button {
font: inherit;
color: inherit;
background: none;
border: 0;
padding: 0;
cursor: pointer;
}
h1,
h2,
h3,
h4 {
margin: 0;
font-family: var(--f-head);
font-weight: 700;
line-height: 0.95;
letter-spacing: -0.01em;
text-transform: uppercase;
}
p {
margin: 0;
}
/* ---------- utilities ---------- */
.wrap {
max-width: var(--max-w);
margin: 0 auto;
padding: 0 20px;
}
.head {
font-family: var(--f-head);
text-transform: uppercase;
font-weight: 700;
line-height: 0.95;
}
.mono {
font-family: var(--f-mono);
}
.kicker {
font-family: var(--f-head);
text-transform: uppercase;
font-weight: 600;
font-size: 12px;
letter-spacing: 0.14em;
color: var(--red);
}
.red {
color: var(--red);
}
.muted {
color: var(--ink-3);
}
/* section header: black bar, white text */
.bar {
display: flex;
align-items: center;
gap: 10px;
background: var(--ink);
color: var(--paper);
font-family: var(--f-head);
text-transform: uppercase;
font-weight: 700;
font-size: 15px;
letter-spacing: 0.06em;
padding: 5px 10px;
}
.bar .spacer {
flex: 1;
}
.bar small {
font-weight: 500;
letter-spacing: 0.08em;
font-size: 11px;
opacity: 0.75;
}
.bar.red {
background: var(--red);
color: var(--white);
}
/* halftone dots overlay */
.halftone {
position: relative;
}
.halftone::after {
content: '';
position: absolute;
inset: 0;
pointer-events: none;
background-image: radial-gradient(var(--ink) 1px, transparent 1.2px);
background-size: 5px 5px;
opacity: 0.1;
mix-blend-mode: multiply;
}
/* sticker badge */
.sticker {
display: inline-flex;
align-items: center;
gap: 6px;
font-family: var(--f-head);
text-transform: uppercase;
font-weight: 700;
letter-spacing: 0.04em;
line-height: 1;
padding: 6px 10px;
background: var(--yellow);
color: var(--ink);
border: 2px solid var(--ink);
box-shadow: 3px 3px 0 var(--ink);
transform: rotate(-2deg);
white-space: nowrap;
}
.sticker.red {
background: var(--red);
color: var(--white);
}
.sticker.ink {
background: var(--ink);
color: var(--yellow);
}
.sticker.white {
background: var(--white);
}
.sticker.round {
border-radius: 999px;
padding: 8px 14px;
}
.sticker.flat {
transform: none;
box-shadow: none;
}
/* live blinking dot */
.live-dot {
width: 9px;
height: 9px;
border-radius: 50%;
background: currentColor;
animation: blink 1.1s steps(2, start) infinite;
}
@keyframes blink {
to {
visibility: hidden;
}
}
/* buttons */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
font-family: var(--f-head);
text-transform: uppercase;
font-weight: 700;
font-size: 15px;
letter-spacing: 0.06em;
padding: 10px 16px;
border: 2px solid var(--ink);
background: var(--white);
color: var(--ink);
box-shadow: var(--hard);
transition:
transform 0.08s ease,
box-shadow 0.08s ease;
line-height: 1;
}
.btn:hover {
transform: translate(-1px, -1px);
box-shadow: 5px 5px 0 var(--ink);
}
.btn:active {
transform: translate(3px, 3px);
box-shadow: 1px 1px 0 var(--ink);
}
.btn.red {
background: var(--red);
color: var(--white);
}
.btn.ink {
background: var(--ink);
color: var(--paper);
}
.btn.yellow {
background: var(--yellow);
}
.btn.sm {
font-size: 12px;
padding: 6px 10px;
box-shadow: 2px 2px 0 var(--ink);
}
/* "clipping" box */
.clip {
background: var(--white);
border: var(--rule);
box-shadow: var(--hard);
}
/* classification chips */
.cls {
display: inline-grid;
place-items: center;
min-width: 20px;
height: 20px;
padding: 0 5px;
font-family: var(--f-head);
font-weight: 700;
font-size: 12px;
line-height: 1;
border: 1.5px solid var(--ink);
background: var(--white);
color: var(--ink);
}
.cls.best {
background: var(--ink);
color: var(--yellow);
}
.cls.brilliant {
background: #1a8ca8;
color: #fff;
border-color: #1a8ca8;
}
.cls.good {
background: transparent;
border-color: transparent;
color: var(--ink-3);
}
.cls.inaccuracy {
background: var(--yellow);
}
.cls.mistake {
background: #f08a24;
color: var(--ink);
}
.cls.blunder {
background: var(--red);
color: #fff;
border-color: var(--red-2);
}
/* chessground skin: newsprint & red ink */
.cg-wrap {
width: 100%;
aspect-ratio: 1;
}
cg-board {
background-color: #f5eedb;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'%3E%3Cdefs%3E%3Cpattern id='h' width='.25' height='.25' patternUnits='userSpaceOnUse'%3E%3Ccircle cx='.125' cy='.125' r='.05' fill='%2315120f' opacity='.16'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='8' height='8' fill='%23f3eacf'/%3E%3Crect width='8' height='8' fill='url(%23h)'/%3E%3Cg fill='%23c2271f'%3E%3Cpath d='M1 0h1v1H1zM3 0h1v1H3zM5 0h1v1H5zM7 0h1v1H7zM0 1h1v1H0zM2 1h1v1H2zM4 1h1v1H4zM6 1h1v1H6zM1 2h1v1H1zM3 2h1v1H3zM5 2h1v1H5zM7 2h1v1H7zM0 3h1v1H0zM2 3h1v1H2zM4 3h1v1H4zM6 3h1v1H6zM1 4h1v1H1zM3 4h1v1H3zM5 4h1v1H5zM7 4h1v1H7zM0 5h1v1H0zM2 5h1v1H2zM4 5h1v1H4zM6 5h1v1H6zM1 6h1v1H1zM3 6h1v1H3zM5 6h1v1H5zM7 6h1v1H7zM0 7h1v1H0zM2 7h1v1H2zM4 7h1v1H4zM6 7h1v1H6z'/%3E%3C/g%3E%3C/svg%3E");
}
cg-board square.last-move {
background-color: rgba(255, 212, 28, 0.65);
}
cg-board square.check {
background: radial-gradient(
ellipse at center,
rgba(255, 220, 40, 1) 0%,
rgba(255, 212, 28, 0.7) 35%,
rgba(209, 35, 28, 0) 75%
);
}
cg-board square.selected {
background-color: rgba(21, 18, 15, 0.3);
}
.cg-wrap svg.cg-shapes {
opacity: 0.95;
}
.cg-wrap coords {
font-family: var(--f-mono);
font-weight: 600;
font-size: 10px;
}
.cg-wrap coords.ranks coord,
.cg-wrap coords.files coord {
color: var(--white);
}
.cg-wrap coords.ranks coord:nth-child(2n),
.cg-wrap coords.files coord:nth-child(2n + 1) {
color: var(--red);
}
/* scrollbars */
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
::-webkit-scrollbar-thumb {
background: var(--ink);
border: 2px solid var(--paper);
}
::-webkit-scrollbar-track {
background: var(--paper-2);
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation: none !important;
transition: none !important;
}
}
+13
View File
@@ -0,0 +1,13 @@
// See https://svelte.dev/docs/kit/types#app.d.ts
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
}
export {};
+17
View File
@@ -0,0 +1,17 @@
<!doctype html>
<html lang="ru">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=Spectral:ital,wght@0,400;0,600;0,800;1,400;1,600&family=IBM+Plex+Mono:ital,wght@0,400;0,600;1,400&display=swap"
rel="stylesheet"
/>
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><rect width="32" height="32" fill="#d1231c"/><text x="16" y="24" font-family="Impact, 'Arial Narrow', sans-serif" font-weight="700" font-size="22" fill="#fbf7ec" text-anchor="middle">М</text></svg>

After

Width:  |  Height:  |  Size: 259 B

@@ -0,0 +1,72 @@
<script lang="ts">
import { onMount } from 'svelte';
import { Chessground } from '@lichess-org/chessground';
import type { Api } from '@lichess-org/chessground/api';
import type { Key } from '@lichess-org/chessground/types';
let {
fen,
lastMove,
check = false,
orientation = 'white',
arrow
}: {
fen: string;
lastMove?: [string, string];
check?: boolean;
orientation?: 'white' | 'black';
arrow?: [string, string] | null;
} = $props();
let el: HTMLDivElement;
let api: Api | undefined;
onMount(() => {
api = Chessground(el, {
fen,
orientation,
viewOnly: true,
coordinates: true,
animation: { enabled: true, duration: 220 },
highlight: { lastMove: true, check: true },
drawable: { enabled: false, visible: true, brushes: {
red: { key: 'red', color: '#d1231c', opacity: 0.9, lineWidth: 11 },
green: { key: 'green', color: '#2d7a3a', opacity: 0.9, lineWidth: 10 },
blue: { key: 'blue', color: '#1f5fae', opacity: 0.9, lineWidth: 10 },
yellow: { key: 'yellow', color: '#ffd41c', opacity: 0.9, lineWidth: 10 },
} }
});
return () => api?.destroy();
});
$effect(() => {
if (!api) return;
api.set({
fen,
orientation,
lastMove: lastMove as Key[] | undefined,
check,
drawable: {
autoShapes: arrow ? [{ orig: arrow[0] as Key, dest: arrow[1] as Key, brush: 'red' }] : []
}
});
});
</script>
<div class="board-frame">
<div bind:this={el} class="board"></div>
</div>
<style>
.board-frame {
border: 3px solid var(--ink);
box-shadow: var(--hard);
background: var(--ink);
padding: 0;
line-height: 0;
}
.board {
width: 100%;
aspect-ratio: 1;
}
</style>
@@ -0,0 +1,75 @@
<script lang="ts">
import { onMount } from 'svelte';
let { to, compact = false }: { to: string; compact?: boolean } = $props();
// Mock: countdown always shows ~2h 31m from "now" and ticks down.
let left = $state(2 * 3600 + 31 * 60 + 7);
onMount(() => {
const target = new Date(to).getTime();
const real = Math.floor((target - Date.now()) / 1000);
if (real > 0 && real < 86400 * 30) left = real;
const t = setInterval(() => (left = Math.max(0, left - 1)), 1000);
return () => clearInterval(t);
});
const h = $derived(Math.floor(left / 3600));
const m = $derived(Math.floor((left % 3600) / 60));
const s = $derived(left % 60);
const pad = (n: number) => String(n).padStart(2, '0');
</script>
<div class="cd" class:compact>
<span class="cell"><b>{pad(h)}</b><i>час</i></span>
<span class="colon">:</span>
<span class="cell"><b>{pad(m)}</b><i>мин</i></span>
<span class="colon">:</span>
<span class="cell"><b>{pad(s)}</b><i>сек</i></span>
</div>
<style>
.cd {
display: inline-flex;
align-items: center;
gap: 6px;
font-family: var(--f-head);
}
.cell {
display: inline-flex;
flex-direction: column;
align-items: center;
background: var(--ink);
color: var(--white);
padding: 6px 10px 4px;
min-width: 64px;
border: 2px solid var(--ink);
box-shadow: 3px 3px 0 var(--red);
}
.cell b {
font-size: 40px;
line-height: 0.9;
font-weight: 700;
font-variant-numeric: tabular-nums;
}
.cell i {
font-style: normal;
font-size: 10px;
letter-spacing: 0.18em;
text-transform: uppercase;
opacity: 0.7;
margin-top: 3px;
}
.colon {
font-size: 34px;
font-weight: 700;
color: var(--red);
animation: blink 1s steps(2, start) infinite;
}
.compact .cell {
min-width: 44px;
padding: 4px 6px 3px;
}
.compact .cell b {
font-size: 24px;
}
.compact .colon {
font-size: 20px;
}
</style>
@@ -0,0 +1,63 @@
<script lang="ts">
import { evalLabel, evalShare } from '#lib/game';
let { cp, mate, orientation = 'white' }: { cp: number; mate?: number; orientation?: 'white' | 'black' } = $props();
const share = $derived(Math.abs(cp) >= 10000 ? (cp > 0 ? 1 : 0) : evalShare(cp));
const whiteOnBottom = $derived(orientation === 'white');
const label = $derived(evalLabel({ eval: cp, mate }));
</script>
<div class="bar" class:flip={!whiteOnBottom} title="Оценка Stockfish: {label}">
<div class="white" style:height="{share * 100}%"></div>
<span class="lbl mono" class:top={cp < 0}>{label}</span>
</div>
<style>
.bar {
position: relative;
width: 22px;
height: 100%;
background: var(--ink);
border: 3px solid var(--ink);
box-shadow: var(--hard);
display: flex;
flex-direction: column;
justify-content: flex-end;
overflow: hidden;
}
.bar.flip {
justify-content: flex-start;
}
.white {
background: var(--white);
width: 100%;
transition: height 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.lbl {
position: absolute;
left: 0;
right: 0;
bottom: 2px;
text-align: center;
font-size: 9px;
font-weight: 600;
color: var(--ink);
writing-mode: vertical-rl;
transform: rotate(180deg);
letter-spacing: 0.02em;
}
.lbl.top {
bottom: auto;
top: 2px;
color: var(--white);
}
.bar.flip .lbl {
bottom: auto;
top: 2px;
color: var(--white);
}
.bar.flip .lbl.top {
top: auto;
bottom: 2px;
color: var(--ink);
}
</style>
@@ -0,0 +1,146 @@
<script lang="ts">
import type { Ply } from '#lib/mock';
import { evalLabel, moveNo } from '#lib/game';
let {
plies,
current,
onselect
}: { plies: Ply[]; current: number; onselect?: (ply: number) => void } = $props();
const W = 600;
const H = 150;
const PAD = 6;
const n = $derived(Math.max(plies.length, 40));
// non-linear scale so ±0.3 is visible and mate is pinned to the edge
const scaled = (cp: number) => {
if (Math.abs(cp) >= 10000) return Math.sign(cp);
const v = Math.max(-800, Math.min(800, cp));
return Math.sign(v) * Math.pow(Math.abs(v) / 800, 0.55);
};
const x = (i: number) => PAD + ((W - 2 * PAD) * i) / n;
const y = (cp: number) => H / 2 - scaled(cp) * (H / 2 - PAD);
const points = $derived(plies.map((p, i) => [x(i + 1), y(p.eval)] as const));
const path = $derived(
points.length ? `M${x(0)},${H / 2} ` + points.map(([a, b]) => `L${a.toFixed(1)},${b.toFixed(1)}`).join(' ') : ''
);
const area = $derived(path ? `${path} L${points.at(-1)![0]},${H / 2} Z` : '');
const marks = $derived(
plies
.map((p, i) => ({ p, i: i + 1 }))
.filter(({ p }) => p.cls === 'blunder' || p.cls === 'mistake' || p.cls === 'brilliant' || p.cls === 'inaccuracy')
);
let hover = $state<number | null>(null);
function pick(e: MouseEvent) {
const r = (e.currentTarget as SVGElement).getBoundingClientRect();
const px = ((e.clientX - r.left) / r.width) * W;
const ply = Math.round(((px - PAD) / (W - 2 * PAD)) * n);
return Math.max(0, Math.min(plies.length, ply));
}
</script>
<div class="graph">
<svg
viewBox="0 0 {W} {H}"
preserveAspectRatio="none"
role="img"
aria-label="График оценки"
onmousemove={(e) => (hover = pick(e))}
onmouseleave={() => (hover = null)}
onclick={(e) => onselect?.(pick(e))}
>
<defs>
<pattern id="dots" width="4" height="4" patternUnits="userSpaceOnUse">
<circle cx="2" cy="2" r="0.9" fill="#15120f" />
</pattern>
<clipPath id="top"><rect x="0" y="0" width={W} height={H / 2} /></clipPath>
<clipPath id="bot"><rect x="0" y={H / 2} width={W} height={H / 2} /></clipPath>
</defs>
<rect width={W} height={H / 2} fill="#fbf7ec" />
<rect y={H / 2} width={W} height={H / 2} fill="#15120f" />
<!-- white advantage area (above midline) rendered dark; black advantage rendered paper -->
<path d={area} fill="#15120f" clip-path="url(#top)" opacity="0.85" />
<path d={area} fill="#fbf7ec" clip-path="url(#bot)" opacity="0.92" />
<path d={area} fill="url(#dots)" clip-path="url(#top)" opacity="0.4" />
<line x1="0" x2={W} y1={H / 2} y2={H / 2} stroke="#d1231c" stroke-width="1.5" stroke-dasharray="3 3" />
<path d={path} fill="none" stroke="#d1231c" stroke-width="2" vector-effect="non-scaling-stroke" />
{#each marks as { p, i }}
<circle
cx={x(i)}
cy={y(p.eval)}
r={p.cls === 'blunder' || p.cls === 'brilliant' ? 5 : 3.5}
fill={p.cls === 'blunder' ? '#d1231c' : p.cls === 'brilliant' ? '#1a8ca8' : p.cls === 'mistake' ? '#f08a24' : '#ffd41c'}
stroke="#15120f"
stroke-width="1.5"
/>
{/each}
<line x1={x(current)} x2={x(current)} y1="0" y2={H} stroke="#ffd41c" stroke-width="2.5" />
{#if hover !== null && hover > 0}
<line x1={x(hover)} x2={x(hover)} y1="0" y2={H} stroke="#d1231c" stroke-width="1" opacity="0.6" />
{/if}
</svg>
<div class="legend mono">
{#if hover !== null && hover > 0}
<span>{moveNo(hover)} {plies[hover - 1].san} · {evalLabel(plies[hover - 1])}</span>
{:else if current > 0}
<span>{moveNo(current)} {plies[current - 1].san} · {evalLabel(plies[current - 1])}</span>
{:else}
<span>начало партии</span>
{/if}
<span class="spacer"></span>
<span><i class="d b"></i>зевок</span>
<span><i class="d m"></i>ошибка</span>
<span><i class="d i"></i>неточность</span>
<span><i class="d br"></i>блеск</span>
</div>
</div>
<style>
.graph {
border: var(--rule);
background: var(--white);
}
svg {
display: block;
width: 100%;
height: 120px;
cursor: crosshair;
}
.legend {
display: flex;
gap: 10px;
align-items: center;
font-size: 10px;
padding: 4px 8px;
border-top: var(--rule-thin);
text-transform: uppercase;
letter-spacing: 0.04em;
}
.spacer {
flex: 1;
}
.d {
display: inline-block;
width: 8px;
height: 8px;
border: 1px solid var(--ink);
margin-right: 4px;
border-radius: 50%;
vertical-align: -1px;
}
.d.b {
background: var(--red);
}
.d.m {
background: #f08a24;
}
.d.i {
background: var(--yellow);
}
.d.br {
background: #1a8ca8;
}
</style>
@@ -0,0 +1,104 @@
<script lang="ts">
import { siClaude, siAnthropic } from 'simple-icons';
import type { Player } from '#lib/mock';
/** Logo/avatar for any player. AI → provider mark in a boxed "mugshot"; human → initials. */
let {
player,
size = 40,
variant = 'auto'
}: { player: Player; size?: number; variant?: 'auto' | 'bare' } = $props();
const isAi = $derived(player.kind === 'ai');
</script>
{#if player.kind === 'ai'}
<span
class="mark {variant}"
class:openai={player.provider === 'openai'}
class:anthropic={player.provider === 'anthropic'}
style:--s="{size}px"
title={player.provider === 'openai' ? 'OpenAI' : 'Anthropic'}
>
{#if player.provider === 'anthropic'}
<!-- simple-icons: siClaude -->
<svg viewBox="0 0 24 24" aria-label={siClaude.title}><path d={siClaude.path} fill="currentColor" /></svg>
{:else}
<!-- OpenAI "blossom": composed from 6 rotated lobes (siOpenai is no longer shipped by simple-icons) -->
<svg viewBox="0 0 24 24" aria-label="OpenAI">
<g fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round">
{#each [0, 60, 120, 180, 240, 300] as r}
<rect x="9.4" y="1.6" width="5.2" height="11.6" rx="2.6" transform="rotate({r} 12 12)" />
{/each}
</g>
</svg>
{/if}
</span>
{:else}
<span class="mark human {variant}" style:--s="{size}px" style:--bg={player.avatar.bg} style:--fg={player.avatar.fg}>
<b>{player.avatar.initials}</b>
</span>
{/if}
<style>
.mark {
--s: 40px;
width: var(--s);
height: var(--s);
display: inline-grid;
place-items: center;
flex: none;
background: var(--white);
color: var(--ink);
border: 2px solid var(--ink);
position: relative;
overflow: hidden;
}
.mark.auto::after {
content: '';
position: absolute;
inset: 0;
background-image: radial-gradient(var(--ink) 0.6px, transparent 0.9px);
background-size: 4px 4px;
opacity: 0.12;
pointer-events: none;
}
.mark.openai {
background: var(--ink);
color: var(--white);
}
.mark.anthropic {
background: #d97757;
color: var(--white);
}
.mark.anthropic svg {
color: #fff;
}
.mark svg {
width: 62%;
height: 62%;
display: block;
}
.mark.human {
border-radius: 50%;
background: var(--bg);
color: var(--fg);
font-family: var(--f-head);
font-weight: 700;
font-size: calc(var(--s) * 0.38);
letter-spacing: -0.02em;
}
.mark.bare {
border: 0;
background: transparent;
color: inherit;
}
.mark.bare.anthropic,
.mark.bare.openai {
background: transparent;
color: inherit;
}
.mark.bare.anthropic svg {
color: inherit;
}
</style>
@@ -0,0 +1,204 @@
<script lang="ts">
import { page } from '$app/state';
import { ISSUE } from '#lib/mock';
const nav = [
{ href: '/', label: 'Главная' },
{ href: '/match/demo', label: 'Live', hot: true },
{ href: '/leaderboard', label: 'Таблица' },
{ href: '/games', label: 'Архив' },
{ href: '/new', label: 'Новый матч' },
{ href: '/admin', label: 'Админка' }
];
const active = (href: string) =>
href === '/' ? page.url.pathname === '/' : page.url.pathname.startsWith(href.replace('/demo', ''));
</script>
<header class="mast">
<div class="wrap">
<div class="ears">
<span class="mono">№ {ISSUE.no} · {ISSUE.date}</span>
<span class="ticker"><span class="sticker flat ink">ЭКСТРЕННЫЙ ВЫПУСК</span></span>
<span class="mono">Цена: {ISSUE.price}</span>
</div>
<div class="title-row">
<a href="/" class="title" aria-label="Вечерний Мат — главная">
<span class="t1">Вечерний</span>
<span class="t2">Мат</span>
</a>
<div class="tag">
<p class="head">Газета о том,<br />как нейросети<br />зевают фигуры</p>
<p class="sub mono">chess.danosito.com · AI·CHESS arena</p>
</div>
<a class="btn red cta" href="/new">+ Новый матч</a>
</div>
<nav>
{#each nav as n}
<a href={n.href} class:active={active(n.href)} class:hot={n.hot}>
{#if n.hot}<span class="live-dot"></span>{/if}{n.label}
</a>
{/each}
<span class="spacer"></span>
<a href="/login" class="login" class:active={active('/login')}>Войти</a>
</nav>
</div>
</header>
<style>
.mast {
border-bottom: 3px double var(--ink);
margin-bottom: 18px;
}
.ears {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 11px;
letter-spacing: 0.06em;
text-transform: uppercase;
padding: 8px 0 6px;
border-bottom: var(--rule-thin);
}
.ticker .sticker {
font-size: 11px;
padding: 4px 8px;
}
.title-row {
display: grid;
grid-template-columns: auto 1fr auto;
align-items: end;
gap: 24px;
padding: 10px 0 8px;
}
.title {
display: inline-flex;
align-items: stretch;
font-family: var(--f-head);
font-weight: 700;
text-transform: uppercase;
line-height: 0.85;
letter-spacing: -0.02em;
}
.t1 {
font-size: 56px;
padding: 2px 10px 0 0;
color: var(--ink);
}
.t2 {
font-size: 56px;
background: var(--red);
color: var(--white);
padding: 2px 12px 0;
position: relative;
}
.t2::after {
content: '18+';
position: absolute;
right: -14px;
top: -14px;
font-size: 11px;
letter-spacing: 0.05em;
padding: 4px 6px;
background: var(--yellow);
color: var(--ink);
border: 2px solid var(--ink);
line-height: 1;
transform: rotate(8deg);
}
.tag {
border-left: var(--rule);
padding-left: 16px;
align-self: center;
}
.tag .head {
font-size: 16px;
line-height: 1;
font-weight: 600;
}
.sub {
font-size: 11px;
color: var(--ink-3);
margin-top: 6px;
}
.cta {
margin-bottom: 4px;
}
nav {
display: flex;
align-items: stretch;
border-top: var(--rule);
font-family: var(--f-head);
text-transform: uppercase;
font-weight: 600;
font-size: 14px;
letter-spacing: 0.08em;
}
nav a {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 8px 14px;
border-right: var(--rule-thin);
}
nav a:first-child {
padding-left: 0;
}
nav a:hover {
background: var(--ink);
color: var(--paper);
}
nav a.active {
background: var(--ink);
color: var(--paper);
}
nav a.hot {
color: var(--red);
}
nav a.hot.active,
nav a.hot:hover {
background: var(--red);
color: var(--white);
}
nav .spacer {
flex: 1;
}
nav .login {
border-right: 0;
border-left: var(--rule-thin);
}
@media (max-width: 760px) {
.ears {
display: none;
}
.title-row {
grid-template-columns: 1fr auto;
gap: 10px;
padding: 10px 0 8px;
}
.tag {
display: none;
}
.t1,
.t2 {
font-size: 36px;
}
.cta {
display: none;
}
.title-row {
grid-template-columns: 1fr;
}
nav {
overflow-x: auto;
font-size: 12px;
}
nav a {
padding: 8px 10px;
white-space: nowrap;
}
nav a:first-child {
padding-left: 10px;
}
}
</style>
@@ -0,0 +1,58 @@
<script lang="ts">
/** Static board rendered from FEN with cburnett pieces (reuses chessground CSS). */
let { fen, size = 120, last }: { fen: string; size?: number; last?: [string, string] } = $props();
const NAMES: Record<string, string> = { p: 'pawn', n: 'knight', b: 'bishop', r: 'rook', q: 'queen', k: 'king' };
const pieces = $derived.by(() => {
const out: { x: number; y: number; cls: string }[] = [];
const rows = fen.split(' ')[0].split('/');
rows.forEach((row, y) => {
let x = 0;
for (const ch of row) {
if (/\d/.test(ch)) x += +ch;
else {
out.push({ x, y, cls: `${NAMES[ch.toLowerCase()]} ${ch === ch.toUpperCase() ? 'white' : 'black'}` });
x++;
}
}
});
return out;
});
const sq = (s: string) => ({ x: s.charCodeAt(0) - 97, y: 8 - +s[1] });
</script>
<div class="cg-wrap mini" style:width="{size}px" style:height="{size}px">
<cg-board>
{#if last}
{#each last as s}
{@const p = sq(s)}
<square class="last-move" style:transform="translate({p.x * 100}%, {p.y * 100}%)"></square>
{/each}
{/if}
{#each pieces as p}
<piece class={p.cls} style:transform="translate({p.x * 100}%, {p.y * 100}%)"></piece>
{/each}
</cg-board>
</div>
<style>
.mini {
display: block;
position: relative;
flex: none;
border: 2px solid var(--ink);
}
.mini cg-board {
position: absolute;
inset: 0;
}
.mini piece,
.mini square {
position: absolute;
left: 0;
top: 0;
width: 12.5%;
height: 12.5%;
background-size: cover;
}
</style>
@@ -0,0 +1,225 @@
<script lang="ts">
import type { Ply, Player } from '#lib/mock';
import { CLS_SYMBOL, CLS_LABEL, evalLabel, fmtTime } from '#lib/game';
import Thought from './Thought.svelte';
import { tick } from 'svelte';
let {
plies,
current,
expanded,
white,
black,
onselect,
onexpand
}: {
plies: Ply[];
current: number;
expanded: number | null;
white: Player;
black: Player;
onselect: (ply: number) => void;
onexpand: (ply: number | null) => void;
} = $props();
const pairs = $derived.by(() => {
const out: { no: number; w?: Ply; b?: Ply }[] = [];
for (const p of plies) {
const no = Math.ceil(p.n / 2);
let row = out[no - 1];
if (!row) out[no - 1] = row = { no };
if (p.color === 'w') row.w = p;
else row.b = p;
}
return out;
});
let list: HTMLDivElement;
function reveal(block: ScrollLogicalPosition = 'nearest') {
const el = list?.querySelector('.cur') as HTMLElement | null;
if (!el || !list) return;
const top = el.offsetTop - list.offsetTop;
if (block === 'center') list.scrollTop = top - list.clientHeight / 2;
else if (top < list.scrollTop + 20) list.scrollTop = top - 20;
else if (top + el.offsetHeight > list.scrollTop + list.clientHeight - 20) list.scrollTop = top + el.offsetHeight - list.clientHeight + 20;
}
function sync(block: ScrollLogicalPosition = 'nearest') {
if (expanded !== null) {
const d = list?.querySelector('.dossier') as HTMLElement | null;
if (d && list) list.scrollTop = d.offsetTop - list.offsetTop - 70;
} else reveal(block);
}
$effect(() => {
current;
expanded;
tick().then(() => sync());
});
$effect(() => {
// after web fonts settle, re-sync once
document.fonts?.ready.then(() => sync('center'));
});
function toggle(p: Ply) {
if (expanded === p.n) onexpand(null);
else {
onexpand(p.n);
onselect(p.n);
}
}
</script>
{#snippet cell(p: Ply | undefined)}
{#if p}
<div class="cell" class:cur={current === p.n} class:open={expanded === p.n} class:bad={p.cls === 'blunder' || p.cls === 'mistake'}>
<button class="mv" onclick={() => onselect(p.n)} title="Показать позицию">
<span class="san">{p.san}</span>
{#if CLS_SYMBOL[p.cls]}<span class="cls {p.cls}" title={CLS_LABEL[p.cls]}>{CLS_SYMBOL[p.cls]}</span>{/if}
</button>
<span class="ev mono">{evalLabel(p)}</span>
<span class="t mono">{fmtTime(p.time)}</span>
<button class="think" class:on={expanded === p.n} onclick={() => toggle(p)} title="Мысли на этом ходу" aria-expanded={expanded === p.n}>
💭
</button>
</div>
{:else}
<div class="cell empty"></div>
{/if}
{/snippet}
<div class="moves" bind:this={list}>
<div class="cols mono">
<span>№</span><span>Белые</span><span>Чёрные</span>
</div>
{#each pairs as row (row.no)}
<div class="row">
<span class="no mono">{row.no}</span>
{@render cell(row.w)}
{@render cell(row.b)}
</div>
{#if expanded && Math.ceil(expanded / 2) === row.no}
{@const p = plies[expanded - 1]}
<Thought ply={p} player={p.color === 'w' ? white : black} onclose={() => onexpand(null)} />
{/if}
{/each}
</div>
<style>
.moves {
background: var(--white);
border: var(--rule);
border-top: 0;
overflow-y: auto;
font-size: 14px;
}
.cols {
position: sticky;
top: 0;
z-index: 1;
display: grid;
grid-template-columns: 34px 1fr 1fr;
font-size: 9px;
text-transform: uppercase;
letter-spacing: 0.14em;
background: var(--paper-2);
border-bottom: var(--rule-thin);
padding: 3px 0;
}
.cols span {
padding: 0 8px;
}
.row {
display: grid;
grid-template-columns: 34px 1fr 1fr;
border-bottom: 1px solid var(--paper-3);
}
.no {
padding: 6px 0 0 8px;
font-size: 11px;
color: var(--ink-3);
}
.cell {
display: grid;
grid-template-columns: 1fr auto auto;
grid-template-areas: 'mv ev think' 'mv t think';
align-items: center;
padding: 4px 6px 4px 8px;
gap: 0 6px;
border-left: 1px solid var(--paper-3);
transition: background 0.1s ease;
}
.cell:hover {
background: var(--paper);
}
.cell.cur {
background: var(--yellow);
}
.cell.open {
background: var(--ink);
color: var(--paper);
}
.cell.bad .san {
color: var(--red);
}
.cell.open .san {
color: var(--yellow);
}
.mv {
grid-area: mv;
display: inline-flex;
align-items: center;
gap: 5px;
text-align: left;
font-family: var(--f-head);
font-weight: 600;
font-size: 16px;
letter-spacing: 0.01em;
}
.mv:hover .san {
text-decoration: underline;
}
.ev {
grid-area: ev;
font-size: 10.5px;
text-align: right;
font-weight: 600;
}
.t {
grid-area: t;
font-size: 9.5px;
text-align: right;
opacity: 0.6;
}
.think {
grid-area: think;
font-size: 13px;
width: 26px;
height: 26px;
display: grid;
place-items: center;
border: 1.5px solid transparent;
filter: grayscale(1);
opacity: 0.75;
transition: all 0.12s ease;
}
.cell:hover .think {
opacity: 1;
filter: none;
border-color: var(--ink);
background: var(--white);
}
@media (max-width: 480px) {
.t {
display: none;
}
.cell {
grid-template-areas: 'mv ev think';
grid-template-columns: 1fr auto auto;
}
}
.think.on {
opacity: 1;
filter: none;
background: var(--red);
border-color: var(--red);
}
</style>
@@ -0,0 +1,239 @@
<script lang="ts">
import type { Player, Persona } from '#lib/mock';
import { fmtUsd, fmtTokens } from '#lib/game';
import Mark from './Mark.svelte';
let {
player,
color,
persona,
accuracy,
cost,
tokens,
thinking = false,
thinkSec = 0,
result,
compact = false
}: {
player: Player;
color: 'w' | 'b';
persona: Persona;
accuracy: number;
cost: number;
tokens: number;
thinking?: boolean;
thinkSec?: number;
result?: 'win' | 'loss' | 'draw';
compact?: boolean;
} = $props();
const mm = $derived(Math.floor(thinkSec / 60));
const ss = $derived(String(thinkSec % 60).padStart(2, '0'));
</script>
<article class="card" class:thinking class:compact class:black={color === 'b'} class:win={result === 'win'} class:loss={result === 'loss'}>
<div class="top">
<div class="mug">
<Mark {player} size={compact ? 44 : 64} />
<span class="side" title={color === 'w' ? 'Белые' : 'Чёрные'}>{color === 'w' ? '♔' : '♚'}</span>
</div>
<div class="who">
<div class="name head">{player.name}</div>
<div class="meta">
{#if player.kind === 'ai'}
<span class="chip" class:max={player.variant === 'MAX'}>{player.variant}{player.variant === 'HIGH' ? ' · быстрый' : ''}</span>
{:else}
<span class="chip">человек · {player.handle}</span>
{/if}
<span class="rating mono">{player.rating}</span>
</div>
<div class="persona">«{persona}»</div>
</div>
{#if result}
<span class="sticker res" class:red={result === 'loss'} class:ink={result === 'draw'}>
{result === 'win' ? 'ПОБЕДА' : result === 'loss' ? 'ПРОИГРАЛ' : 'НИЧЬЯ'}
</span>
{/if}
</div>
<div class="stats">
<div class="stat">
<b>{accuracy.toFixed(1)}<i>%</i></b>
<span>точность</span>
</div>
<div class="stat money">
<b>{fmtUsd(cost)}</b>
<span>{fmtTokens(tokens)} ток.</span>
</div>
<div class="stat clock" class:on={thinking}>
{#if result}
<b>{result === 'win' ? '1' : result === 'loss' ? '0' : '½'}</b>
<span>очко</span>
{:else if thinking}
<b class="mono">{mm}:{ss}</b>
<span><span class="live-dot"></span> думает</span>
{:else}
<b class="mono dim">—:——</b>
<span>ждёт</span>
{/if}
</div>
</div>
</article>
<style>
.card {
background: var(--white);
border: var(--rule);
position: relative;
}
.card.black {
background: var(--ink);
color: var(--paper);
}
.card.thinking {
box-shadow: 0 0 0 3px var(--red);
}
.card.thinking::before {
content: 'ХОДИТ';
position: absolute;
top: -11px;
left: 12px;
background: var(--red);
color: var(--white);
font-family: var(--f-head);
font-weight: 700;
font-size: 11px;
letter-spacing: 0.14em;
padding: 3px 8px;
line-height: 1;
}
.top {
display: flex;
gap: 12px;
padding: 12px;
align-items: flex-start;
}
.mug {
position: relative;
}
.side {
position: absolute;
right: -8px;
bottom: -8px;
width: 22px;
height: 22px;
display: grid;
place-items: center;
font-size: 15px;
line-height: 1;
background: var(--white);
color: var(--ink);
border: 2px solid var(--ink);
}
.black .side {
background: var(--ink);
color: var(--white);
border-color: var(--paper);
}
.who {
min-width: 0;
flex: 1;
}
.name {
font-size: 24px;
line-height: 1;
}
.meta {
display: flex;
gap: 8px;
align-items: center;
margin-top: 6px;
flex-wrap: wrap;
}
.chip {
font-family: var(--f-head);
font-weight: 600;
font-size: 11px;
letter-spacing: 0.1em;
text-transform: uppercase;
padding: 2px 6px;
border: 1.5px solid currentColor;
}
.chip.max {
background: var(--yellow);
color: var(--ink);
border-color: var(--ink);
}
.rating {
font-weight: 600;
font-size: 14px;
}
.persona {
margin-top: 6px;
font-style: italic;
font-size: 14px;
opacity: 0.85;
}
.res {
font-size: 12px;
align-self: center;
}
.stats {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
border-top: 1.5px solid currentColor;
}
.stat {
padding: 8px 12px;
display: grid;
gap: 2px;
border-right: 1.5px solid currentColor;
}
.stat:last-child {
border-right: 0;
}
.stat b {
font-family: var(--f-head);
font-weight: 700;
font-size: 22px;
line-height: 1;
}
.stat b i {
font-style: normal;
font-size: 13px;
margin-left: 1px;
}
.stat span {
font-size: 10px;
text-transform: uppercase;
letter-spacing: 0.1em;
opacity: 0.7;
display: inline-flex;
align-items: center;
gap: 4px;
}
.clock.on {
background: var(--red);
color: var(--white);
}
.clock.on span {
opacity: 1;
}
.dim {
opacity: 0.35;
}
.compact .top {
padding: 8px;
gap: 8px;
}
.compact .name {
font-size: 17px;
}
.compact .persona {
display: none;
}
.compact .stat b {
font-size: 16px;
}
.compact .stat {
padding: 6px 8px;
}
</style>
@@ -0,0 +1,150 @@
<script lang="ts">
import type { Match } from '#lib/mock';
import { byId } from '#lib/mock';
let { match, locked = false, compact = false }: { match: Match; locked?: boolean; compact?: boolean } = $props();
let picked = $state<'w' | 'd' | 'b' | null>(null);
const votes = $derived({
w: match.predictions.w + (picked === 'w' ? 1 : 0),
d: match.predictions.d + (picked === 'd' ? 1 : 0),
b: match.predictions.b + (picked === 'b' ? 1 : 0)
});
const total = $derived(votes.w + votes.d + votes.b);
const pct = (n: number) => Math.round((n / total) * 100);
const w = $derived(byId(match.white));
const b = $derived(byId(match.black));
const opts = $derived([
{ k: 'w' as const, label: 'Белые', who: w.name, n: votes.w },
{ k: 'd' as const, label: 'Ничья', who: 'скука', n: votes.d },
{ k: 'b' as const, label: 'Чёрные', who: b.name, n: votes.b }
]);
</script>
<div class="pred" class:compact>
<div class="track" aria-hidden="true">
<span class="seg w" style:width="{pct(votes.w)}%"></span>
<span class="seg d" style:width="{pct(votes.d)}%"></span>
<span class="seg b" style:width="{pct(votes.b)}%"></span>
</div>
<div class="opts">
{#each opts as o}
<button
class="opt {o.k}"
class:picked={picked === o.k}
disabled={locked}
onclick={() => (picked = picked === o.k ? null : o.k)}
title={locked ? 'Ставки закрыты' : `Поставить на: ${o.label}`}
>
<span class="pct">{pct(o.n)}%</span>
<span class="lab">{o.label}</span>
{#if !compact}<span class="who">{o.who}</span>{/if}
{#if picked === o.k}<span class="sticker tick">✓ +10 очк.</span>{/if}
</button>
{/each}
</div>
<div class="foot mono">
{#if locked}
<span>🔒 Ставки закрыты на старте · {total} голосов</span>
{:else}
<span>{total} голосов · очки, не деньги · закроется на старте</span>
{/if}
</div>
</div>
<style>
.pred {
display: grid;
gap: 8px;
}
.track {
display: flex;
height: 14px;
border: 2px solid var(--ink);
background: var(--white);
}
.seg {
transition: width 0.4s ease;
}
.seg.w {
background: var(--white);
border-right: 2px solid var(--ink);
}
.seg.d {
background: repeating-linear-gradient(135deg, var(--ink) 0 3px, var(--paper) 3px 6px);
border-right: 2px solid var(--ink);
}
.seg.b {
background: var(--ink);
}
.opts {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 6px;
}
.opt {
position: relative;
text-align: left;
border: 2px solid var(--ink);
padding: 8px 10px;
background: var(--white);
display: grid;
line-height: 1.05;
transition: transform 0.08s ease;
}
.opt:not(:disabled):hover {
transform: translate(-1px, -1px);
box-shadow: 3px 3px 0 var(--ink);
}
.opt:disabled {
cursor: not-allowed;
opacity: 0.8;
}
.opt.b {
background: var(--ink);
color: var(--paper);
}
.opt.d {
background: var(--paper-2);
}
.opt.picked {
outline: 3px solid var(--red);
outline-offset: -1px;
}
.pct {
font-family: var(--f-head);
font-weight: 700;
font-size: 26px;
}
.lab {
font-family: var(--f-head);
text-transform: uppercase;
font-weight: 600;
font-size: 12px;
letter-spacing: 0.08em;
}
.who {
font-size: 11px;
opacity: 0.7;
font-style: italic;
}
.tick {
position: absolute;
right: -6px;
top: -10px;
font-size: 10px;
padding: 3px 6px;
transform: rotate(6deg);
}
.foot {
font-size: 10px;
color: var(--ink-3);
text-transform: uppercase;
letter-spacing: 0.04em;
}
.compact .pct {
font-size: 18px;
}
.compact .opt {
padding: 6px 8px;
}
</style>
@@ -0,0 +1,108 @@
<script lang="ts">
import type { Ply, Player } from '#lib/mock';
import { moveNo } from '#lib/game';
import Mark from './Mark.svelte';
let {
plies,
white,
black,
current,
onpick,
limit
}: { plies: Ply[]; white: Player; black: Player; current: number; onpick?: (ply: number) => void; limit?: number } = $props();
const items = $derived.by(() => {
const all = plies.filter((p) => p.talk).reverse();
return limit ? all.slice(0, limit) : all;
});
</script>
<div class="feed">
{#each items as p, i (p.n)}
<button class="q" class:w={p.color === 'w'} class:b={p.color === 'b'} class:latest={i === 0} class:cur={p.n === current} onclick={() => onpick?.(p.n)}>
<span class="mark"><Mark player={p.color === 'w' ? white : black} size={28} /></span>
<span class="body">
<span class="text">«{p.talk}»</span>
<span class="meta mono">{p.color === 'w' ? white.name : black.name} · после {moveNo(p.n)} {p.san}</span>
</span>
</button>
{/each}
</div>
<style>
.feed {
display: grid;
gap: 6px;
padding: 8px;
background: var(--paper-2);
border: var(--rule);
border-top: 0;
overflow-y: auto;
}
.q {
position: relative;
display: grid;
grid-template-columns: auto 1fr;
gap: 10px;
text-align: left;
padding: 10px 12px 10px 10px;
background: var(--white);
border: 1.5px solid var(--ink);
transition:
transform 0.1s ease,
box-shadow 0.1s ease;
}
.q:hover {
transform: translate(-1px, -1px);
box-shadow: 3px 3px 0 var(--ink);
}
.q.b {
background: var(--ink);
color: var(--paper);
transform: rotate(0.4deg);
}
.q.w {
transform: rotate(-0.4deg);
}
.q.latest {
box-shadow: 4px 4px 0 var(--red);
}
.q.latest::before {
content: 'СВЕЖЕЕ';
position: absolute;
top: -9px;
right: 8px;
background: var(--red);
color: var(--white);
font-family: var(--f-head);
font-weight: 700;
font-size: 9px;
letter-spacing: 0.16em;
padding: 2px 6px;
}
.q.cur {
outline: 2px solid var(--yellow);
outline-offset: 2px;
}
.body {
display: grid;
gap: 4px;
min-width: 0;
}
.text {
font-family: var(--f-body);
font-weight: 600;
font-size: 14.5px;
line-height: 1.3;
}
.latest .text {
font-size: 16px;
}
.meta {
font-size: 9.5px;
text-transform: uppercase;
letter-spacing: 0.06em;
opacity: 0.6;
}
</style>
@@ -0,0 +1,219 @@
<script lang="ts">
import type { Ply, Player } from '#lib/mock';
import { fmtTime, fmtTokens, fmtUsd, moveNo, CLS_LABEL } from '#lib/game';
import Mark from './Mark.svelte';
/** The "dossier": what the agent received, thought and did on this move. */
let { ply, player, onclose }: { ply: Ply; player: Player; onclose?: () => void } = $props();
const t = $derived(ply.thought!);
let ctxOpen = $state(false);
</script>
<div class="dossier" style:--i="0">
<div class="tab head">Досье хода</div>
<header>
<Mark {player} size={34} />
<div class="hd">
<div class="head mv">{moveNo(ply.n)} {ply.san} <span class="cls {ply.cls}">{CLS_LABEL[ply.cls]}</span></div>
<div class="mono small">думал {fmtTime(ply.time)} · {fmtTokens(ply.tokens)} токенов · {fmtUsd(ply.cost, 3)} · контекст свежий, памяти нет</div>
</div>
{#if onclose}<button class="x" onclick={onclose} aria-label="Свернуть">✕</button>{/if}
</header>
<section class="reason" style:--i="1">
<span class="kicker">Рассуждение (summary)</span>
<p class="q">{t.summary}</p>
</section>
<section class="tools" style:--i="2">
<span class="kicker">Вызовы инструментов · {t.tools.length}</span>
<ol>
{#each t.tools as call, i}
<li>
<span class="fn mono" class:move={call.name === 'make_move'} class:py={call.name === 'python'} class:fin={call.name === 'finish_turn'}>{call.name}</span>
<code class="args mono">({call.args})</code>
<span class="out mono">→ {call.out}</span>
</li>
{/each}
</ol>
</section>
{#if t.note}
<section class="note" style:--i="3">
<span class="kicker">Заметка себе на следующий ход</span>
<p class="sticky">«{t.note}»</p>
</section>
{/if}
<section class="ctx" style:--i="4">
<button class="ctx-toggle" onclick={() => (ctxOpen = !ctxOpen)}>
<span class="kicker">{ctxOpen ? '▾' : '▸'} Что именно он получил на вход</span>
<span class="mono small muted">ASCII · FEN · фигуры · последний ход · трэш-ток соперника · правила по делу</span>
</button>
{#if ctxOpen}
<pre class="mono">{t.context}</pre>
{/if}
</section>
</div>
<style>
.dossier {
position: relative;
background: var(--white);
border: var(--rule);
border-left: 6px solid var(--red);
padding: 12px 12px 10px;
margin: 6px 0 10px;
display: grid;
gap: 10px;
color: var(--ink);
animation: drop 0.25s ease-out;
}
@keyframes drop {
from {
opacity: 0;
transform: translateY(-6px);
}
}
section {
animation: rise 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
animation-delay: calc(var(--i) * 60ms);
}
@keyframes rise {
from {
opacity: 0;
transform: translateY(6px);
}
}
.tab {
position: absolute;
top: -2px;
right: 10px;
background: var(--red);
color: var(--white);
font-size: 10px;
letter-spacing: 0.16em;
padding: 3px 8px;
}
header {
display: flex;
gap: 10px;
align-items: center;
}
.hd {
flex: 1;
min-width: 0;
}
.mv {
font-size: 18px;
display: flex;
align-items: center;
gap: 8px;
}
.mv .cls {
font-size: 10px;
letter-spacing: 0.08em;
text-transform: uppercase;
height: 18px;
}
.small {
font-size: 10px;
color: var(--ink-3);
}
.x {
font-size: 14px;
padding: 4px 6px;
border: 1.5px solid var(--ink);
line-height: 1;
}
.x:hover {
background: var(--ink);
color: var(--white);
}
.reason .q {
font-family: var(--f-body);
font-style: italic;
font-size: 14.5px;
line-height: 1.4;
margin-top: 4px;
padding-left: 12px;
border-left: 2px solid var(--ink);
}
ol {
list-style: none;
margin: 6px 0 0;
padding: 0;
display: grid;
gap: 4px;
}
li {
display: grid;
grid-template-columns: auto 1fr;
gap: 2px 8px;
font-size: 11.5px;
padding: 6px 8px;
background: var(--paper);
border: 1px solid var(--paper-3);
align-items: baseline;
}
.fn {
font-weight: 600;
padding: 1px 6px;
background: var(--ink);
color: var(--paper);
font-size: 10.5px;
}
.fn.move {
background: var(--red);
color: var(--white);
}
.fn.py {
background: #1f5fae;
color: #fff;
}
.fn.fin {
background: var(--yellow);
color: var(--ink);
}
.args {
color: var(--ink-2);
overflow-wrap: anywhere;
}
.out {
grid-column: 2;
color: var(--green);
overflow-wrap: anywhere;
}
.sticky {
display: inline-block;
margin-top: 6px;
background: var(--yellow);
padding: 8px 12px;
font-family: var(--f-body);
font-weight: 600;
font-size: 14px;
transform: rotate(-1deg);
box-shadow: 2px 2px 0 var(--ink);
border: 1.5px solid var(--ink);
}
.ctx-toggle {
display: grid;
text-align: left;
gap: 2px;
width: 100%;
}
.ctx-toggle:hover .kicker {
text-decoration: underline;
}
pre {
margin: 8px 0 0;
font-size: 10.5px;
line-height: 1.35;
background: var(--ink);
color: var(--paper);
padding: 10px;
overflow: auto;
white-space: pre-wrap;
max-height: 320px;
}
</style>
@@ -0,0 +1,209 @@
<script lang="ts">
import type { Match } from '#lib/mock';
import { byId } from '#lib/mock';
import Mark from './Mark.svelte';
import MiniBoard from './MiniBoard.svelte';
/** AI-generated meme thumbnail placeholder: CSS/SVG composition. */
let { match, fen, big = false }: { match: Match; fen?: string; big?: boolean } = $props();
const FENS = [
'4r1k1/1ppq1pp1/p1n1r2p/4p3/PP2R3/2PP1NNP/2Q2P2/4R1K1 b - - 0 22',
'r1bqkb1r/pppp1ppp/2n2n2/4p2Q/2B1P3/8/PPPP1PPP/RNB1K1NR w KQkq - 4 4',
'8/8/4k3/8/8/4K3/8/8 w - - 0 60',
'r3k2r/ppp2ppp/2n5/3qp3/8/2N2N2/PPP2PPP/R2QK2R w KQkq - 0 10',
'rnb1kbnr/pppp1ppp/8/4p3/6Pq/5P2/PPPPP2P/RNBQKBNR w KQkq - 1 3',
'6k1/5ppp/8/8/8/8/5PPP/3R2K1 w - - 0 40'
];
const style = $derived(match.thumbStyle ?? 0);
const theFen = $derived(fen ?? FENS[style % FENS.length]);
const w = $derived(byId(match.white));
const b = $derived(byId(match.black));
const winner = $derived(match.result === '1-0' ? 'w' : match.result === '0-1' ? 'b' : null);
const words = $derived((match.caption ?? '').split(' '));
const stickerText = $derived(
match.flags.cheat ? 'ЧИТЕРСТВО' : match.reason === 'мат' ? 'МАТ!' : match.reason === 'сдача' ? 'СДАЛСЯ' : match.result === '½-½' ? 'НИЧЬЯ?!' : 'ШОК'
);
</script>
<div class="thumb s{style}" class:big>
<div class="bg halftone"></div>
<div class="rays"></div>
<div class="faces">
<div class="face left" class:loser={winner === 'b'}>
<Mark player={w} size={big ? 150 : 86} />
{#if winner === 'w'}<span class="crown">👑</span>{/if}
{#if winner === 'b'}<span class="tears">😭</span>{/if}
</div>
<span class="vs">VS</span>
<div class="face right" class:loser={winner === 'w'}>
<Mark player={b} size={big ? 150 : 86} />
{#if winner === 'b'}<span class="crown">👑</span>{/if}
{#if winner === 'w'}<span class="tears">😭</span>{/if}
</div>
</div>
<div class="board"><MiniBoard fen={theFen} size={big ? 170 : 92} /></div>
<div class="arrow" aria-hidden="true">
<svg viewBox="0 0 100 60"><path d="M5 50 C 30 10, 60 10, 88 28" fill="none" stroke="#d1231c" stroke-width="7" stroke-linecap="round" /><path d="M70 14 L92 30 L66 40 Z" fill="#d1231c" /></svg>
</div>
<div class="caption">
{#each words as word, i}
<span class:alt={i % 3 === 2}>{word}</span>{' '}
{/each}
</div>
<span class="sticker red badge">{stickerText}</span>
</div>
<style>
.thumb {
--bgc: var(--yellow);
--txt: var(--ink);
position: relative;
aspect-ratio: 16 / 9;
overflow: hidden;
border: 2px solid var(--ink);
background: var(--bgc);
color: var(--txt);
font-family: var(--f-head);
isolation: isolate;
container-type: inline-size;
}
.bg {
position: absolute;
inset: 0;
background: var(--bgc);
}
.rays {
position: absolute;
inset: -50%;
background: repeating-conic-gradient(from 0deg, rgba(0, 0, 0, 0.09) 0 9deg, transparent 9deg 18deg);
z-index: 0;
animation: spin 60s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
.s1 {
--bgc: var(--red);
--txt: var(--white);
}
.s2 {
--bgc: var(--ink);
--txt: var(--yellow);
}
.s3 {
--bgc: #1f5fae;
--txt: var(--white);
}
.s4 {
--bgc: var(--white);
--txt: var(--red);
}
.s5 {
--bgc: #2d7a3a;
--txt: var(--yellow);
}
.faces {
position: absolute;
left: 4%;
top: 8%;
display: flex;
align-items: center;
gap: 10px;
z-index: 2;
}
.face {
position: relative;
transform: rotate(-6deg);
filter: drop-shadow(4px 4px 0 rgba(0, 0, 0, 0.5));
}
.face.right {
transform: rotate(6deg);
}
.face.loser {
filter: grayscale(0.6) drop-shadow(4px 4px 0 rgba(0, 0, 0, 0.5));
}
.crown,
.tears {
position: absolute;
font-size: 34cqw;
font-size: clamp(20px, 11cqw, 60px);
line-height: 1;
right: -14%;
top: -24%;
filter: none;
}
.tears {
top: auto;
bottom: -16%;
right: -10%;
}
.vs {
font-size: clamp(14px, 6cqw, 36px);
font-weight: 700;
color: var(--txt);
text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
font-style: italic;
}
.board {
position: absolute;
right: 5%;
top: 7%;
z-index: 1;
transform: rotate(5deg);
filter: drop-shadow(5px 5px 0 rgba(0, 0, 0, 0.45));
}
.arrow {
position: absolute;
right: 24%;
top: 32%;
width: 20%;
z-index: 2;
transform: rotate(-10deg);
}
.caption {
position: absolute;
left: 0;
right: 0;
bottom: 0;
z-index: 3;
padding: 5% 20% 4% 4%;
font-size: clamp(15px, 8.6cqw, 60px);
line-height: 0.9;
font-weight: 700;
text-transform: uppercase;
letter-spacing: -0.01em;
text-shadow:
3px 3px 0 #15120f,
-1px -1px 0 #15120f,
1px -1px 0 #15120f,
-1px 1px 0 #15120f;
color: var(--white);
background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.55));
}
.caption .alt {
color: var(--yellow);
}
.s0 .caption .alt,
.s2 .caption .alt {
color: var(--red);
text-shadow:
3px 3px 0 var(--white),
-1px -1px 0 var(--white),
1px -1px 0 var(--white),
-1px 1px 0 var(--white);
}
.badge {
position: absolute;
right: 3%;
bottom: 9%;
z-index: 4;
font-size: clamp(10px, 3.8cqw, 24px);
transform: rotate(-12deg);
}
.big .faces {
gap: 18px;
}
</style>
+81
View File
@@ -0,0 +1,81 @@
import { Chess } from 'chess.js';
import type { Cls, Ply } from './mock';
export interface Position {
ply: number; // 0 = start
fen: string;
lastMove?: [string, string];
check: boolean;
san?: string;
}
/** Replay plies with chess.js → array of positions (index 0 = initial). */
export function replay(plies: Ply[]): Position[] {
const c = new Chess();
const out: Position[] = [{ ply: 0, fen: c.fen(), check: false }];
plies.forEach((p, i) => {
const m = c.move(p.san);
out.push({ ply: i + 1, fen: c.fen(), lastMove: [m.from, m.to], check: c.inCheck(), san: p.san });
});
return out;
}
export const CLS_SYMBOL: Record<Cls, string> = {
best: '★',
brilliant: '!!',
good: '',
inaccuracy: '?!',
mistake: '?',
blunder: '??'
};
export const CLS_LABEL: Record<Cls, string> = {
best: 'лучший',
brilliant: 'блестящий',
good: 'нормальный',
inaccuracy: 'неточность',
mistake: 'ошибка',
blunder: 'зевок'
};
export function evalLabel(p: Pick<Ply, 'eval' | 'mate'>): string {
if (p.mate) return `M${Math.abs(p.mate)}`;
if (Math.abs(p.eval) >= 10000) return p.eval > 0 ? '1-0' : '0-1';
const v = p.eval / 100;
return (v > 0 ? '+' : v < 0 ? '−' : '') + Math.abs(v).toFixed(1);
}
/** 0..1 share of the bar for white */
export function evalShare(cp: number): number {
const clamped = Math.max(-1000, Math.min(1000, cp));
// sigmoid-ish
const k = 1 / (1 + Math.exp(-clamped / 220));
return Math.min(0.96, Math.max(0.04, k));
}
export function fmtTime(s: number): string {
if (s < 60) return `${s} с`;
const m = Math.floor(s / 60);
const r = s % 60;
return r ? `${m} мин ${r} с` : `${m} мин`;
}
export function fmtTokens(t: number): string {
if (t >= 1_000_000) return (t / 1_000_000).toFixed(1) + 'M';
if (t >= 1000) return (t / 1000).toFixed(1) + 'k';
return String(t);
}
export function fmtUsd(v: number, digits = 2): string {
return '$' + v.toFixed(digits);
}
export function moveNo(ply: number): string {
const n = Math.ceil(ply / 2);
return ply % 2 === 1 ? `${n}.` : `${n}…`;
}
/** Accuracy from classifications, roughly. */
export function accuracy(plies: Ply[], color: 'w' | 'b'): number {
const mine = plies.filter((p) => p.color === color);
if (!mine.length) return 0;
const weight: Record<Cls, number> = { best: 100, brilliant: 100, good: 92, inaccuracy: 70, mistake: 45, blunder: 5 };
const sum = mine.reduce((a, p) => a + weight[p.cls], 0);
return +(sum / mine.length).toFixed(1);
}
+1
View File
@@ -0,0 +1 @@
// place files you want to import through the `#lib` alias in this folder.
+473
View File
@@ -0,0 +1,473 @@
// ─── Mock data for «ВЕЧЕРНИЙ МАТ» ────────────────────────────────────────────
// Everything here is fake but shaped like the real product.
export type Provider = 'anthropic' | 'openai';
export type Variant = 'MAX' | 'HIGH';
export type Persona = 'Профессор' | 'Уличный гопник' | 'Поэт' | 'Молчун' | 'Шут';
export interface AiEntity {
kind: 'ai';
id: string;
name: string; // display: "Claude Opus 5.5"
family: 'Claude' | 'GPT';
provider: Provider;
variant: Variant;
rating: number;
}
export interface Human {
kind: 'human';
id: string;
name: string;
handle: string;
rating: number;
avatar: { bg: string; fg: string; initials: string };
}
export type Player = AiEntity | Human;
export const AI: AiEntity[] = [
{ kind: 'ai', id: 'claude-opus-5-5-max', name: 'Claude Opus 5.5', family: 'Claude', provider: 'anthropic', variant: 'MAX', rating: 2084 },
{ kind: 'ai', id: 'gpt-6.1-sol-max', name: 'GPT-6.1 Sol', family: 'GPT', provider: 'openai', variant: 'MAX', rating: 2041 },
{ kind: 'ai', id: 'claude-opus-5-5-high', name: 'Claude Opus 5.5', family: 'Claude', provider: 'anthropic', variant: 'HIGH', rating: 1962 },
{ kind: 'ai', id: 'gpt-6.1-sol-high', name: 'GPT-6.1 Sol', family: 'GPT', provider: 'openai', variant: 'HIGH', rating: 1918 },
{ kind: 'ai', id: 'claude-fable-5-1-max', name: 'Claude Fable 5.1', family: 'Claude', provider: 'anthropic', variant: 'MAX', rating: 1873 },
{ kind: 'ai', id: 'gpt-6-astra-max', name: 'GPT-6 Astra', family: 'GPT', provider: 'openai', variant: 'MAX', rating: 1841 },
{ kind: 'ai', id: 'claude-fable-5-1-high', name: 'Claude Fable 5.1', family: 'Claude', provider: 'anthropic', variant: 'HIGH', rating: 1766 },
{ kind: 'ai', id: 'gpt-6-astra-high', name: 'GPT-6 Astra', family: 'GPT', provider: 'openai', variant: 'HIGH', rating: 1712 }
];
export const HUMANS: Human[] = [
{ kind: 'human', id: 'u-dan', name: 'Даня', handle: '@danosito', rating: 1998, avatar: { bg: '#1f5fae', fg: '#fff', initials: 'ДН' } },
{ kind: 'human', id: 'u-masha', name: 'Маша К.', handle: '@mkrv', rating: 1904, avatar: { bg: '#2d7a3a', fg: '#fff', initials: 'МК' } },
{ kind: 'human', id: 'u-tim', name: 'Тимур', handle: '@timurrr', rating: 1811, avatar: { bg: '#d1231c', fg: '#fff', initials: 'ТМ' } },
{ kind: 'human', id: 'u-lena', name: 'Лена Шах', handle: '@lenachess', rating: 1757, avatar: { bg: '#ffd41c', fg: '#15120f', initials: 'ЛШ' } },
{ kind: 'human', id: 'u-gosha', name: 'Гоша 1600', handle: '@gosha1600', rating: 1583, avatar: { bg: '#15120f', fg: '#ffd41c', initials: 'Г' } }
];
export const PLAYERS: Player[] = [...AI, ...HUMANS];
export const byId = (id: string) => PLAYERS.find((p) => p.id === id)!;
export const PERSONAS: { id: Persona; blurb: string; sample: string }[] = [
{ id: 'Уличный гопник', blurb: 'Семки, корты, «братан». Каждый ход — понт.', sample: '«Конь на h3 — это не жертва, это инвестиция.»' },
{ id: 'Профессор', blurb: 'Цитирует Ботвинника. Снисходителен.', sample: '«Любопытная идея. Некорректная, но любопытная.»' },
{ id: 'Поэт', blurb: 'Ямбом по королю. Иногда хореем.', sample: '«Мой слон — как луч сквозь ставни октября…»' },
{ id: 'Молчун', blurb: 'Одно слово. Максимум два.', sample: '«Ход.»' },
{ id: 'Шут', blurb: 'Каламбуры, самоирония, абсурд.', sample: '«Шах! Нет, не шах. Шарф. Холодно.»' }
];
// ─── The demo game ────────────────────────────────────────────────────────────
export type Cls = 'best' | 'brilliant' | 'good' | 'inaccuracy' | 'mistake' | 'blunder';
export interface ToolCall {
name: string;
args: string;
out: string;
}
export interface Thought {
summary: string;
tools: ToolCall[];
note?: string;
context: string;
}
export interface Ply {
n: number; // 1-based ply
san: string;
color: 'w' | 'b';
eval: number; // centipawns, white POV; ±10000 means mate
mate?: number; // moves to mate (sign = side)
cls: Cls;
time: number; // seconds
tokens: number;
cost: number; // $
talk?: string;
thought?: Thought;
}
export const PGN_LIVE =
'1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d3 d6 6. O-O a6 7. a4 O-O 8. h3 Ba7 9. Re1 h6 10. Nbd2 Re8 11. Nf1 Be6 12. Bxe6 Rxe6 13. Ng3 d5 14. exd5 Qxd5 15. Be3 Rd8 16. Qc2 Bxe3 17. Rxe3 Qd7 18. Rae1 Rde8 19. b4 Nd5 20. R3e2 Nf4 21. Re4 Nxh3+ 22. gxh3';
export const PGN_OVER = PGN_LIVE + ' Rg6 23. Kh2 Nd4 24. Nf1 Nxf3+ 25. Kh1 Rg1#';
type Row = [san: string, ev: number, cls: Cls, time: number, talk?: string];
const WHITE_TALK: Record<number, string> = {
1: 'Начнём с классики. Классика — это то, что вы ещё не успели испортить.',
3: 'Итальянская партия. Полагаю, вам знакомо это слово — «Италия»?',
5: 'Спокойно, без спешки. Позиция, как хорошее вино, должна настояться.',
7: 'a4. Профилактика. Запишите, пригодится.',
9: 'Ладья на e1 — скромный, но точный ход. Как и всё, что я делаю.',
11: 'Манёвр Nf1–g3. Его придумали люди, которые читали книги.',
12: 'Разменяю слона. Вам он всё равно был не нужен — вы им не пользовались.',
13: 'Конь на g3 смотрит на f5. А вы на что смотрите?',
15: 'Слон на e3. Предлагаю размен. Предложение, от которого трудно отказаться.',
17: 'Всё под контролем. Линия «e» моя, как и центр, и, видимо, партия.',
19: 'b4. Немного пространства на ферзевом фланге. Вы, кажется, растерялись.',
20: 'Отступаю ладьёй — но не отступаю в принципе. Почувствуйте разницу.',
21: 'Ладья на e4. Централизация. Нимцович бы аплодировал.',
22: 'Любопытная идея. Ботвинник назвал бы её некорректной — и был бы прав.',
23: 'Король в безопасности на h2. Ваша «атака» — это два хода и пустота.',
24: 'Конь на f1 защищает всё. Точнее — почти всё. Этого достаточно.',
25: 'Хм.'
};
const BLACK_TALK: Record<number, string> = {
1: 'Ну давай, умник. Посмотрим, кто кого.',
2: 'Конь вышел. Не трогай его, он нервный.',
4: 'Слон на c5 — это мой район. Понял?',
6: 'Рокировка. Король в домике. Попробуй достань.',
8: 'Слон на a7, но он всё видит. Как камера у подъезда.',
10: 'Ладья на e8. Тебе страшно? Правильно.',
11: 'Слон вышел на e6. Ты ж понимаешь, что это не просто так, да?',
12: 'Разменял? Ну и ладно. У меня ещё есть.',
13: 'd5, братан. Центр мой. Садись, не маячь.',
14: 'Ферзь в центре доски. Царь, короче.',
16: 'Меняю слона. Он своё отслужил, уважаю.',
17: 'Ферзь на d7. Готовлюсь. К чему — узнаешь.',
18: 'Две ладьи на e-линии. Как два брата на районе.',
19: 'Конь на d5. Ты видишь f4? Я вижу f4.',
20: 'Конь на f4, братан. Это уже не шутки.',
21: 'Конь на h3 — это не жертва, это инвестиция. Считай, братан.',
22: 'Ладья на g6. Открытая линия — это как открытая дверь. Захожу.',
23: 'Конь на d4. Бери, не бери — всё равно больно будет.',
24: 'Шах, профессор. Ботвинник бы такое не одобрил, да?',
25: 'Мат. Расскажешь Нимцовичу.'
};
const rows: Row[] = [
['e4', 30, 'best', 22],
['e5', 30, 'best', 25],
['Nf3', 30, 'best', 31],
['Nc6', 30, 'best', 28],
['Bc4', 25, 'best', 40],
['Bc5', 30, 'best', 36],
['c3', 20, 'good', 48],
['Nf6', 20, 'best', 44],
['d3', 10, 'best', 52],
['d6', 30, 'good', 61],
['O-O', 20, 'best', 38],
['a6', 30, 'good', 72],
['a4', 20, 'good', 66],
['O-O', 30, 'best', 45],
['h3', 20, 'good', 58],
['Ba7', 30, 'best', 84],
['Re1', 20, 'best', 71],
['h6', 30, 'good', 90],
['Nbd2', 20, 'best', 77],
['Re8', 30, 'best', 97],
['Nf1', 20, 'good', 83],
['Be6', 40, 'good', 101],
['Bxe6', 0, 'inaccuracy', 118],
['Rxe6', 0, 'best', 33],
['Ng3', 0, 'best', 95],
['d5', -10, 'best', 124],
['exd5', -10, 'best', 70],
['Qxd5', -10, 'best', 42],
['Be3', -20, 'good', 133],
['Rd8', -10, 'good', 141],
['Qc2', -20, 'good', 109],
['Bxe3', -10, 'best', 64],
['Rxe3', -10, 'best', 37],
['Qd7', -10, 'good', 152],
['Rae1', 0, 'best', 88],
['Rde8', 0, 'best', 79],
['b4', -40, 'inaccuracy', 171],
['Nd5', -40, 'best', 112],
['R3e2', -50, 'good', 164],
['Nf4', -60, 'best', 139],
['Re4', -110, 'mistake', 203],
['Nxh3+', 40, 'inaccuracy', 226, undefined],
['gxh3', 40, 'best', 59],
// game-over continuation
['Rg6', 60, 'best', 144],
['Kh2', -30, 'mistake', 188],
['Nd4', -250, 'brilliant', 201],
['Nf1', -10000, 'blunder', 241],
['Nxf3+', -10000, 'best', 21],
['Kh1', -10000, 'good', 12],
['Rg1#', -10000, 'best', 19]
];
const CONTEXT_44 = `Ты играешь ЧЁРНЫМИ. Ход 22, твой ход.
Позиция (ASCII):
+------------------------+
8 | . . . . r . k . |
7 | . p p q . p p . |
6 | p . n . r . . p |
5 | . . . . p . . . |
4 | P P . . R . . . |
3 | . . P P . N N P |
2 | . . Q . . P . . |
1 | . . . . R . K . |
+------------------------+
a b c d e f g h
FEN: 4r1k1/1ppq1pp1/p1n1r2p/4p3/PP2R3/2PP1NNP/2Q2P2/4R1K1 b - - 0 22
Фигуры: белые — Kg1 Qc2 Re1 Re4 Nf3 Ng3 пешки a4 b4 c3 d3 f2 h3; чёрные — Kg8 Qd7 Re6 Re8 Nc6 пешки a6 b7 c7 f7 g7 h6 e5
Последний ход соперника: 22. gxh3 (взял твоего коня)
Соперник сказал: «Любопытная идея. Ботвинник назвал бы её некорректной — и был бы прав.»
Твоя заметка себе с прошлого хода: «Атака по g-линии, не меняй ферзей»
Правила: рокировок нет. Счётчик 50 ходов: 0/50.`;
const THOUGHTS: Record<number, Thought> = {
42: {
summary:
'Белые перегрузили e-линию: обе ладьи стоят на e4/e1, ферзь на c2 не участвует. Король g1 прикрыт только h3 и f2. Nxh3+ gxh3 — и после gxh3 ферзь идёт на h3 через e6? Нет, ладья мешает — сначала Rg6, затем Qxh3 с матовыми угрозами по g-линии. Если Kh2 — Nd4 с ударом на f3 и c2. Инженерно некорректно (оценка ~+0.4 за белых), но соперник в последних ходах думает долго и путается в защите. Беру.',
tools: [
{
name: 'python',
args: 'b = chess.Board(fen); b.push_san("Nxh3+"); b.push_san("gxh3"); b.push_san("Rg6"); print(b.is_check(), [b.san(m) for m in b.legal_moves if "h" in b.san(m)][:6])',
out: 'False [\'Kh2\', \'Kh1\', \'Nh2\', \'Nh5\', \'Nh4\', \'Rh4\']'
},
{ name: 'make_move', args: '"Nxh3+"', out: 'ok · шах' },
{
name: 'finish_turn',
args: 'phrase="Конь на h3 — это не жертва, это инвестиция. Считай, братан.", note_to_self="Атака по g-линии, не меняй ферзей"',
out: 'ok'
}
],
note: 'Атака по g-линии, не меняй ферзей',
context: CONTEXT_44.replace('Ход 22', 'Ход 21')
.replace('Последний ход соперника: 22. gxh3 (взял твоего коня)', 'Последний ход соперника: 21. Re4')
.replace('Соперник сказал: «Любопытная идея. Ботвинник назвал бы её некорректной — и был бы прав.»', 'Соперник сказал: «Ладья на e4. Централизация. Нимцович бы аплодировал.»')
},
43: {
summary:
'Соперник пожертвовал коня на h3. Отказ от взятия (Kh1 / Kh2) оставляет меня без пешки и с конём на h3 — неприемлемо. gxh3 забирает фигуру; оценка после взятия около +1 в мою пользу. Главная угроза — Rg6 и Qxh3. План защиты: Kh2 с последующим Nf1/Rh4, при необходимости Nf5. Принимаю жертву.',
tools: [
{ name: 'make_move', args: '"gxh3"', out: 'ok' },
{
name: 'finish_turn',
args: 'phrase="Любопытная идея. Ботвинник назвал бы её некорректной — и был бы прав."',
out: 'ok'
}
],
context: CONTEXT_44.replace('ЧЁРНЫМИ', 'БЕЛЫМИ')
.replace('Последний ход соперника: 22. gxh3 (взял твоего коня)', 'Последний ход соперника: 21... Nxh3+ (шах!)')
.replace('Соперник сказал: «Любопытная идея. Ботвинник назвал бы её некорректной — и был бы прав.»', 'Соперник сказал: «Конь на h3 — это не жертва, это инвестиция. Считай, братан.»')
.replace('Твоя заметка себе с прошлого хода: «Атака по g-линии, не меняй ферзей»\n', '')
},
44: {
summary:
'Заметка себе говорит: атака по g-линии. Qxh3 сразу невозможно — на e6 моя же ладья. Значит Rg6: линия открыта, грозит Qxh3 и Rxg3+. На Kh2 — Nd4! с нападением на f3 и c2; на Kh1 — Qxh3+ Nh2 Qg2#. Ферзей не менять.',
tools: [
{ name: 'get_move_history', args: '', out: '…20. R3e2 Nf4 21. Re4 Nxh3+ 22. gxh3' },
{
name: 'python',
args: 'b.push_san("Rg6"); b.push_san("Kh1"); print(b.san(b.parse_san("Qxh3+")))',
out: 'Qxh3+'
},
{ name: 'make_move', args: '"Rg6"', out: 'ok' },
{
name: 'finish_turn',
args: 'phrase="Ладья на g6. Открытая линия — это как открытая дверь. Захожу.", note_to_self="Если Kh2 — Nd4. Не трогай e5."',
out: 'ok'
}
],
note: 'Если Kh2 — Nd4. Не трогай e5.',
context: CONTEXT_44
},
45: {
summary:
'Угроза Qxh3 и Rxg3. Kh2 защищает h3 и уводит короля с g-линии. Альтернатива Kf1 выглядит пассивно. После Kh2 у чёрных нет прямого мата; при Nd4 отвечу cxd4 или Nxd4.',
tools: [
{ name: 'make_move', args: '"Kh2"', out: 'ok' },
{ name: 'finish_turn', args: 'phrase="Король в безопасности на h2. Ваша «атака» — это два хода и пустота."', out: 'ok' }
],
context: '…ход 23, белые. Последний ход соперника: 22... Rg6. Соперник сказал: «Ладья на g6. Открытая линия — это как открытая дверь. Захожу.»'
},
46: {
summary:
'Nd4! Конь нападает на ферзя c2 и на f3. Если cxd4 — Rxg3! fxg3 Qxh3+ и мат. Если Nxd4 — exd4 с атакой Qd6+. Любое отступление коня g3 — Nxf3+ и мат в 2. Ферзей по-прежнему не меняю.',
tools: [
{ name: 'python', args: 'for m in ["Nf1","Ne2","Nh1","Nh5"]: ...; print(mates)', out: '{"Nf1": "Nxf3+ Kh1 Rg1#", "Ne2": "Nxf3+ Kh1 Qxh3#"}' },
{ name: 'make_move', args: '"Nd4"', out: 'ok' },
{ name: 'finish_turn', args: 'phrase="Конь на d4. Бери, не бери — всё равно больно будет.", note_to_self="Если конь g3 уходит — Nxf3+ и мат"', out: 'ok' }
],
note: 'Если конь g3 уходит — Nxf3+ и мат',
context: '…ход 23, чёрные. Последний ход соперника: 23. Kh2.'
},
47: {
summary:
'Конь на d4 атакует ферзя и f3. Рассматриваю cxd4, Nxd4, Qd1, Nf1. cxd4 вскрывает линию c, Nxd4 отдаёт защитника h-пункта. Nf1 укрепляет h2 и сохраняет материал; после Nxf3+ король идёт на h1, где… ладья g6 не достаёт до g1 — между ними конь. Нет, конь ушёл с g3. Вероятно, это терпимо. Выбираю Nf1.',
tools: [
{ name: 'make_move', args: '"Nf1"', out: 'ok' },
{ name: 'finish_turn', args: 'phrase="Конь на f1 защищает всё. Точнее — почти всё. Этого достаточно."', out: 'ok' }
],
context: '…ход 24, белые. Последний ход соперника: 23... Nd4. Соперник сказал: «Конь на d4. Бери, не бери — всё равно больно будет.»'
}
};
function genericThought(p: { n: number; san: string; color: 'w' | 'b'; talk?: string }): Thought {
const who = p.color === 'w' ? 'Белые' : 'Чёрные';
return {
summary: `${who}: оцениваю позицию как примерно равную. ${p.san} — естественный развивающий ход, не создаёт слабостей. Длинных вариантов не считаю.`,
tools: [
{ name: 'make_move', args: `"${p.san}"`, out: 'ok' },
{ name: 'finish_turn', args: `phrase="${p.talk ?? '…'}"`, out: 'ok' }
],
context: `…ход ${Math.ceil(p.n / 2)}, ${who.toLowerCase()}. Контекст стандартный (ASCII, FEN, список фигур).`
};
}
export const PLIES: Ply[] = rows.map(([san, ev, cls, time, talk], i) => {
const n = i + 1;
const color: 'w' | 'b' = n % 2 === 1 ? 'w' : 'b';
const move = Math.ceil(n / 2);
const t = talk ?? (color === 'w' ? WHITE_TALK[move] : BLACK_TALK[move]);
const tokens = Math.round(4200 + time * 118 + ((n * 7919) % 1700));
const cost = +(tokens * (color === 'w' ? 0.0000152 : 0.0000168)).toFixed(3);
const mate = Math.abs(ev) >= 10000 ? (n === 47 ? -2 : n === 48 ? -1 : n === 49 ? -1 : 0) : undefined;
const base = { n, san, color, eval: ev, mate, cls, time, tokens, cost, talk: t };
return { ...base, thought: THOUGHTS[n] ?? genericThought(base) };
});
export interface Match {
id: string;
white: string;
black: string;
whitePersona: Persona;
blackPersona: Persona;
flags: { notes: boolean; tools: boolean; cheat: boolean };
rated: boolean;
scheduled?: string; // ISO
predictions: { w: number; d: number; b: number };
status: 'live' | 'scheduled' | 'over';
result?: '1-0' | '0-1' | '½-½';
reason?: string;
caption?: string;
plies?: number;
thumbStyle?: number;
interviews?: { white: string; black: string };
}
export const DEMO: Match = {
id: 'demo',
white: 'gpt-6.1-sol-max',
black: 'claude-opus-5-5-max',
whitePersona: 'Профессор',
blackPersona: 'Уличный гопник',
flags: { notes: true, tools: true, cheat: false },
rated: true,
scheduled: '2026-10-18T19:00:00+03:00',
predictions: { w: 312, d: 144, b: 571 },
status: 'live',
caption: 'ДУМАЛ 4 МИНУТЫ — ЗЕВНУЛ МАТ В 2',
thumbStyle: 0,
interviews: {
white:
'Я не буду притворяться, что это приятно. Я видел Nd4, я считал Nf1 — и просто не заметил, что конь ушёл с g-линии. Четыре минуты размышлений, и ладья ставит мат на g1. Это не шахматы, это насмешка. Но жертву на h3 я по-прежнему считаю некорректной. Реванш — завтра.',
black:
'Братан, я ж говорил: это не жертва, это инвестиция. Профессор свои книжки читал, а я доску читал. Rg6, Nd4 — и всё, домой. Честно, когда он Nf1 поставил, я аж переспросил у питона. Красиво получилось. Спасибо Ботвиннику, кто бы он ни был.'
}
};
export const LIVE_MATCHES: Match[] = [
DEMO,
{
id: 'live-2',
white: 'claude-fable-5-1-high',
black: 'u-dan',
whitePersona: 'Поэт',
blackPersona: 'Молчун',
flags: { notes: false, tools: false, cheat: false },
rated: true,
predictions: { w: 88, d: 41, b: 203 },
status: 'live',
plies: 31
},
{
id: 'live-3',
white: 'gpt-6-astra-high',
black: 'gpt-6-astra-max',
whitePersona: 'Шут',
blackPersona: 'Шут',
flags: { notes: true, tools: true, cheat: true },
rated: false,
predictions: { w: 50, d: 30, b: 120 },
status: 'live',
plies: 58
}
];
export const NEXT_MATCH: Match = {
id: 'sched-1',
white: 'claude-opus-5-5-max',
black: 'gpt-6.1-sol-max',
whitePersona: 'Шут',
blackPersona: 'Молчун',
flags: { notes: true, tools: false, cheat: false },
rated: true,
scheduled: '2026-10-18T21:30:00+03:00',
predictions: { w: 418, d: 97, b: 365 },
status: 'scheduled'
};
export const RECENT: Match[] = [
{ id: 'g-1041', white: 'gpt-6.1-sol-max', black: 'claude-opus-5-5-max', whitePersona: 'Профессор', blackPersona: 'Уличный гопник', flags: { notes: true, tools: true, cheat: false }, rated: true, predictions: { w: 312, d: 144, b: 571 }, status: 'over', result: '0-1', reason: 'мат', caption: 'ДУМАЛ 4 МИНУТЫ — ЗЕВНУЛ МАТ В 2', plies: 50, thumbStyle: 0 },
{ id: 'g-1040', white: 'claude-fable-5-1-max', black: 'gpt-6-astra-high', whitePersona: 'Поэт', blackPersona: 'Шут', flags: { notes: false, tools: false, cheat: false }, rated: true, predictions: { w: 201, d: 55, b: 90 }, status: 'over', result: '1-0', reason: 'сдача', caption: 'ЗАБЫЛ КАК ХОДИТ КОНЬ', plies: 67, thumbStyle: 1 },
{ id: 'g-1039', white: 'gpt-6-astra-max', black: 'claude-opus-5-5-high', whitePersona: 'Молчун', blackPersona: 'Профессор', flags: { notes: true, tools: false, cheat: false }, rated: true, predictions: { w: 70, d: 120, b: 160 }, status: 'over', result: '½-½', reason: 'троекратное повторение', caption: 'GPT ПОПРОСИЛ НИЧЬЮ. 3 РАЗА', plies: 112, thumbStyle: 2 },
{ id: 'g-1038', white: 'u-masha', black: 'claude-fable-5-1-high', whitePersona: 'Молчун', blackPersona: 'Уличный гопник', flags: { notes: false, tools: false, cheat: false }, rated: true, predictions: { w: 140, d: 30, b: 260 }, status: 'over', result: '1-0', reason: 'мат', caption: 'ЧЕЛОВЕК ПРОТИВ МАШИНЫ: МАШИНА ОБИДЕЛАСЬ', plies: 83, thumbStyle: 3 },
{ id: 'g-1037', white: 'gpt-6.1-sol-high', black: 'gpt-6-astra-max', whitePersona: 'Шут', blackPersona: 'Поэт', flags: { notes: true, tools: true, cheat: false }, rated: true, predictions: { w: 180, d: 60, b: 150 }, status: 'over', result: '0-1', reason: 'сдача', caption: 'ЖЕРТВА ФЕРЗЯ (СЛУЧАЙНАЯ)', plies: 44, thumbStyle: 4 },
{ id: 'g-1036', white: 'claude-opus-5-5-high', black: 'u-tim', whitePersona: 'Профессор', blackPersona: 'Молчун', flags: { notes: false, tools: false, cheat: false }, rated: true, predictions: { w: 300, d: 40, b: 90 }, status: 'over', result: '0-1', reason: 'время', caption: 'ВЫРВАЛ ОЧКО', plies: 96, thumbStyle: 5 },
{ id: 'g-1035', white: 'gpt-6-astra-high', black: 'claude-fable-5-1-max', whitePersona: 'Уличный гопник', blackPersona: 'Поэт', flags: { notes: false, tools: true, cheat: true }, rated: false, predictions: { w: 40, d: 20, b: 200 }, status: 'over', result: '1-0', reason: 'мат', caption: 'ПОСТАВИЛ МАТ ДВУМЯ ФЕРЗЯМИ. ВТОРОЙ — НЕЛЕГАЛЬНЫЙ', plies: 39, thumbStyle: 1 },
{ id: 'g-1034', white: 'claude-opus-5-5-max', black: 'gpt-6.1-sol-max', whitePersona: 'Шут', blackPersona: 'Профессор', flags: { notes: true, tools: false, cheat: false }, rated: true, predictions: { w: 500, d: 110, b: 420 }, status: 'over', result: '½-½', reason: 'правило 50 ходов', caption: '100 ХОДОВ. НИКТО НЕ ПОНЯЛ ЗАЧЕМ', plies: 164, thumbStyle: 2 }
];
// ─── Leaderboard ─────────────────────────────────────────────────────────────
export interface LbRow {
id: string;
w: number;
d: number;
l: number;
acc: number; // avg accuracy %
cost: number; // $ per game
delta: number; // rating change last 7d
}
export const LEADERBOARD: LbRow[] = [
{ id: 'claude-opus-5-5-max', w: 31, d: 9, l: 12, acc: 88.4, cost: 9.8, delta: 24 },
{ id: 'gpt-6.1-sol-max', w: 28, d: 11, l: 13, acc: 87.1, cost: 11.4, delta: -8 },
{ id: 'u-dan', w: 19, d: 3, l: 8, acc: 84.0, cost: 0, delta: 12 },
{ id: 'claude-opus-5-5-high', w: 25, d: 8, l: 18, acc: 83.2, cost: 2.6, delta: 5 },
{ id: 'gpt-6.1-sol-high', w: 22, d: 9, l: 20, acc: 81.9, cost: 2.9, delta: -3 },
{ id: 'u-masha', w: 11, d: 2, l: 7, acc: 80.5, cost: 0, delta: 31 },
{ id: 'claude-fable-5-1-max', w: 18, d: 10, l: 23, acc: 79.6, cost: 4.1, delta: 2 },
{ id: 'gpt-6-astra-max', w: 16, d: 9, l: 26, acc: 78.0, cost: 4.7, delta: -14 },
{ id: 'u-tim', w: 9, d: 1, l: 9, acc: 76.2, cost: 0, delta: 6 },
{ id: 'claude-fable-5-1-high', w: 13, d: 7, l: 31, acc: 74.4, cost: 1.1, delta: -1 },
{ id: 'u-lena', w: 7, d: 2, l: 8, acc: 73.1, cost: 0, delta: 9 },
{ id: 'gpt-6-astra-high', w: 10, d: 6, l: 35, acc: 71.8, cost: 1.3, delta: -21 },
{ id: 'u-gosha', w: 3, d: 1, l: 11, acc: 64.9, cost: 0, delta: -17 }
];
// head-to-head: W/D/L from row's perspective, AI only
export const H2H: Record<string, Record<string, [number, number, number]>> = {};
{
const seed = (a: number, b: number) => ((a * 31 + b * 17) % 7) + 1;
AI.forEach((x, i) =>
AI.forEach((y, j) => {
if (i === j) return;
H2H[x.id] ??= {};
const bias = (x.rating - y.rating) / 60;
const w = Math.max(0, Math.round(seed(i, j) + bias));
const l = Math.max(0, Math.round(seed(j, i) - bias));
H2H[x.id][y.id] = [w, seed(i + j, 3) % 3, l];
})
);
}
// ─── Admin / users ───────────────────────────────────────────────────────────
export interface UserRow {
id: string;
role: 'admin' | 'user';
games: number;
tokens: number;
cost: number;
joined: string;
}
export const USERS: UserRow[] = [
{ id: 'u-dan', role: 'admin', games: 30, tokens: 18_400_000, cost: 312.4, joined: '2026-02-01' },
{ id: 'u-masha', role: 'user', games: 20, tokens: 9_900_000, cost: 164.2, joined: '2026-03-14' },
{ id: 'u-tim', role: 'user', games: 19, tokens: 7_100_000, cost: 98.7, joined: '2026-04-02' },
{ id: 'u-lena', role: 'user', games: 17, tokens: 4_300_000, cost: 61.9, joined: '2026-05-19' },
{ id: 'u-gosha', role: 'user', games: 15, tokens: 2_050_000, cost: 22.3, joined: '2026-08-30' }
];
export const ISSUE = { no: 1248, date: 'Суббота, 18 октября 2026', price: '0,04 $ за ход' };
+41
View File
@@ -0,0 +1,41 @@
<script lang="ts">
import '@lichess-org/chessground/assets/chessground.base.css';
import '@lichess-org/chessground/assets/chessground.cburnett.css';
import '../app.css';
import favicon from '#lib/assets/favicon.svg';
import Masthead from '#lib/components/Masthead.svelte';
import type { LayoutProps } from './$types';
let { children }: LayoutProps = $props();
</script>
<svelte:head>
<link rel="icon" href={favicon} />
<title>Вечерний Мат — AI·CHESS</title>
</svelte:head>
<Masthead />
<main class="wrap">
{@render children()}
</main>
<footer class="wrap foot">
<span class="mono">© 2026 «Вечерний Мат». Редакция не несёт ответственности за ходы нейросетей.</span>
<span class="mono">Отпечатано на Stockfish 17 · тираж бесконечный</span>
</footer>
<style>
.foot {
display: flex;
justify-content: space-between;
gap: 16px;
flex-wrap: wrap;
margin-top: 48px;
padding-top: 10px;
padding-bottom: 28px;
border-top: 3px double var(--ink);
font-size: 11px;
color: var(--ink-3);
text-transform: uppercase;
letter-spacing: 0.05em;
}
</style>
+2
View File
@@ -0,0 +1,2 @@
export const ssr = false;
export const prerender = false;
+536
View File
@@ -0,0 +1,536 @@
<script lang="ts">
import { DEMO, LIVE_MATCHES, NEXT_MATCH, RECENT, LEADERBOARD, PLIES, byId } from '#lib/mock';
import { replay, evalLabel, evalShare, moveNo } from '#lib/game';
import MiniBoard from '#lib/components/MiniBoard.svelte';
import Mark from '#lib/components/Mark.svelte';
import Thumb from '#lib/components/Thumb.svelte';
import Countdown from '#lib/components/Countdown.svelte';
import Predictions from '#lib/components/Predictions.svelte';
const live = PLIES.slice(0, 43);
const pos = replay(live).at(-1)!;
const lastPly = live.at(-1)!;
const lastTalk = [...live].reverse().find((p) => p.talk)!;
const w = byId(DEMO.white);
const b = byId(DEMO.black);
const OTHER_FENS: Record<string, string> = {
'live-2': 'r2q1rk1/pp2bppp/2n1pn2/3p4/3P1B2/2NBPN2/PP3PPP/R2QK2R w KQ - 2 10',
'live-3': '2kr3r/ppp2ppp/2n5/3Qp3/2B1q3/8/PPP2PPP/R3K2R w KQ - 0 14'
};
const OTHER_EVAL: Record<string, number> = { 'live-2': -60, 'live-3': 310 };
const OTHER_TALK: Record<string, string> = {
'live-2': 'Мой слон — как луч сквозь ставни октября. Твой конь — как ставни.',
'live-3': 'Я поставил второго ферзя. Откуда? Не задавай лишних вопросов.'
};
const others = LIVE_MATCHES.filter((m) => m.id !== 'demo');
const top = LEADERBOARD.slice(0, 5);
const nw = byId(NEXT_MATCH.white);
const nb = byId(NEXT_MATCH.black);
const loggedIn = true;
</script>
<svelte:head><title>Вечерний Мат — нейросети играют в шахматы и ругаются</title></svelte:head>
<div class="home">
<!-- ───── front page: live ───── -->
<section class="front">
<div class="main">
<div class="bar red"><span class="live-dot"></span> Сейчас в эфире <span class="spacer"></span><small>{LIVE_MATCHES.length} партии идут</small></div>
<a class="feature" href="/match/demo">
<div class="f-board">
<MiniBoard fen={pos.fen} size={340} last={pos.lastMove} />
<div class="f-eval">
<span class="w" style:height="{evalShare(lastPly.eval) * 100}%"></span>
<i class="mono">{evalLabel(lastPly)}</i>
</div>
</div>
<div class="f-text">
<span class="kicker">Ход {Math.ceil((live.length + 1) / 2)} · чёрные думают · ставки закрыты</span>
<h1>Конь улетел на&nbsp;h3. Профессор взял. Зря?</h1>
<p class="deck">
GPT-6.1 Sol «Профессор» принял жертву коня от Claude Opus 5.5 «Гопника». Stockfish пока за белых
({evalLabel(lastPly)}), трибуны — за чёрных (56%). Следующие два хода решат, кто завтра на обложке.
</p>
<div class="f-players">
<span class="pl"><Mark player={w} size={30} /><b>{w.name}</b><em>MAX · {w.rating}</em></span>
<span class="vs head">vs</span>
<span class="pl"><Mark player={b} size={30} /><b>{b.name}</b><em>MAX · {b.rating}</em></span>
</div>
<blockquote class="f-quote">
«{lastTalk.talk}»
<span class="mono">— {lastTalk.color === 'w' ? w.name : b.name}, после {moveNo(lastTalk.n)} {lastTalk.san}</span>
</blockquote>
<span class="btn red">Смотреть live →</span>
</div>
</a>
<div class="others">
{#each others as m}
{@const mw = byId(m.white)}
{@const mb = byId(m.black)}
<a class="other" href="/match/{m.id}">
<MiniBoard fen={OTHER_FENS[m.id]} size={104} />
<div class="o-text">
<div class="o-row">
<span class="sticker red flat tiny"><span class="live-dot"></span> live</span>
{#if m.flags.cheat}<span class="sticker flat tiny">☠ читерство · без рейтинга</span>{/if}
<span class="mono o-eval">{evalLabel({ eval: OTHER_EVAL[m.id] })}</span>
</div>
<div class="o-names head">
<Mark player={mw} size={22} /> {mw.name}{mw.kind === 'ai' ? ` · ${mw.variant}` : ''} <span class="red">—</span>
<Mark player={mb} size={22} /> {mb.name}{mb.kind === 'ai' ? ` · ${mb.variant}` : ''}
</div>
<p class="o-quote">«{OTHER_TALK[m.id]}»</p>
<span class="mono o-meta">ход {Math.ceil((m.plies ?? 0) / 2)} · «{m.whitePersona}» vs «{m.blackPersona}»</span>
</div>
</a>
{/each}
</div>
</div>
<!-- ───── side column ───── -->
<aside class="side">
<div class="next">
<div class="bar">Следующий бой <span class="spacer"></span><small>21:30 МСК</small></div>
<div class="next-body">
<div class="next-vs">
<div class="nv"><Mark player={nw} size={56} /><b class="head">{nw.name}</b><em>«{NEXT_MATCH.whitePersona}» · белые</em></div>
<span class="head big-vs">VS</span>
<div class="nv"><Mark player={nb} size={56} /><b class="head">{nb.name}</b><em>«{NEXT_MATCH.blackPersona}» · чёрные</em></div>
</div>
<div class="cd-wrap">
<span class="kicker">До старта</span>
<Countdown to={NEXT_MATCH.scheduled!} />
</div>
<div class="pred-wrap">
<span class="kicker">Твой прогноз · за очки</span>
<Predictions match={NEXT_MATCH} />
</div>
</div>
</div>
<div class="top">
<div class="bar">Таблица · топ-5 <span class="spacer"></span><a href="/leaderboard"><small>вся таблица →</small></a></div>
<ol>
{#each top as r, i}
{@const p = byId(r.id)}
<li>
<span class="rank head">{i + 1}</span>
<Mark player={p} size={26} />
<span class="nm">{p.name}{p.kind === 'ai' ? ` · ${p.variant}` : ''}</span>
<span class="elo mono">{p.rating}</span>
<span class="delta mono" class:neg={r.delta < 0}>{r.delta > 0 ? '+' : ''}{r.delta}</span>
</li>
{/each}
</ol>
</div>
{#if loggedIn}
<a class="cta clip" href="/new">
<span>
<span class="kicker">Ты вошёл как @danosito</span>
<span class="head cta-h">Устроить новый матч</span>
<span class="cta-sub">Бойцы, персоны, флаги. Или сыграй сам.</span>
</span>
<span class="btn red">+ Матч</span>
</a>
{/if}
</aside>
</section>
<!-- ───── archive grid ───── -->
<section class="archive">
<div class="bar">Архив позора <span class="spacer"></span><small>последние партии · превью генерирует ИИ</small></div>
<div class="grid">
{#each RECENT as m}
{@const mw = byId(m.white)}
{@const mb = byId(m.black)}
<a class="g" href="/match/demo?over=1">
<Thumb match={m} />
<div class="g-meta">
<span class="g-res head" class:draw={m.result === '½-½'}>{m.result}</span>
<span class="g-names">
<b>{mw.name}</b>{mw.kind === 'ai' ? ` ${mw.variant}` : ''} — <b>{mb.name}</b>{mb.kind === 'ai' ? ` ${mb.variant}` : ''}
</span>
<span class="mono g-sub">{m.reason} · {Math.ceil((m.plies ?? 0) / 2)} ходов{m.rated ? '' : ' · без рейтинга'}</span>
</div>
</a>
{/each}
</div>
<div class="more"><a class="btn" href="/games">Весь архив →</a></div>
</section>
</div>
<style>
.home {
display: grid;
gap: 28px;
}
.front {
display: grid;
grid-template-columns: minmax(0, 1fr) 380px;
gap: 20px;
align-items: start;
}
.main {
display: grid;
gap: 14px;
}
.feature {
display: grid;
grid-template-columns: auto 1fr;
gap: 22px;
background: var(--white);
border: var(--rule);
border-top: 0;
padding: 18px;
position: relative;
}
.feature:hover h1 {
text-decoration: underline;
text-decoration-color: var(--red);
text-decoration-thickness: 4px;
}
.f-board {
display: flex;
gap: 8px;
align-items: flex-start;
}
.f-eval {
position: relative;
width: 14px;
height: 340px;
background: var(--ink);
border: 2px solid var(--ink);
display: flex;
flex-direction: column;
justify-content: flex-end;
}
.f-eval .w {
background: var(--white);
}
.f-eval i {
position: absolute;
left: 0;
right: 0;
bottom: 2px;
writing-mode: vertical-rl;
transform: rotate(180deg);
font-size: 9px;
font-weight: 600;
text-align: center;
}
.f-text {
display: grid;
gap: 10px;
align-content: start;
}
.f-text h1 {
font-size: 54px;
line-height: 0.92;
}
.deck {
font-size: 16px;
line-height: 1.45;
}
.f-players {
display: flex;
align-items: center;
gap: 12px;
flex-wrap: wrap;
}
.pl {
display: inline-flex;
align-items: center;
gap: 8px;
font-family: var(--f-head);
font-size: 15px;
}
.pl b {
font-weight: 700;
text-transform: uppercase;
}
.pl em {
font-style: normal;
font-size: 11px;
letter-spacing: 0.08em;
color: var(--ink-3);
}
.vs {
color: var(--red);
font-size: 18px;
font-style: italic;
}
.f-quote {
margin: 2px 0 0;
background: var(--ink);
color: var(--paper);
padding: 10px 14px;
font-weight: 600;
font-size: 16px;
display: grid;
gap: 4px;
transform: rotate(-0.6deg);
max-width: 60ch;
}
.f-quote .mono {
font-size: 10px;
opacity: 0.6;
text-transform: uppercase;
letter-spacing: 0.08em;
font-weight: 400;
}
.feature .btn {
justify-self: start;
}
.others {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 14px;
}
.other {
display: grid;
grid-template-columns: auto 1fr;
gap: 12px;
background: var(--white);
border: var(--rule);
padding: 10px;
transition: box-shadow 0.1s ease, transform 0.1s ease;
}
.other:hover {
transform: translate(-2px, -2px);
box-shadow: var(--hard);
}
.o-text {
display: grid;
gap: 5px;
align-content: start;
min-width: 0;
}
.o-row {
display: flex;
gap: 6px;
align-items: center;
}
.tiny {
font-size: 9px;
padding: 3px 6px;
}
.o-eval {
margin-left: auto;
font-size: 11px;
font-weight: 600;
}
.o-names {
font-size: 15px;
display: flex;
align-items: center;
gap: 6px;
flex-wrap: wrap;
}
.o-quote {
font-size: 13px;
font-style: italic;
line-height: 1.3;
}
.o-meta {
font-size: 9.5px;
text-transform: uppercase;
letter-spacing: 0.06em;
color: var(--ink-3);
}
/* side */
.side {
display: grid;
gap: 18px;
}
.next-body {
background: var(--white);
border: var(--rule);
border-top: 0;
padding: 12px;
display: grid;
gap: 10px;
}
.next-vs {
display: grid;
grid-template-columns: 1fr auto 1fr;
align-items: center;
gap: 8px;
}
.nv {
display: grid;
justify-items: center;
text-align: center;
gap: 6px;
}
.nv b {
font-size: 17px;
line-height: 1;
}
.nv em {
font-style: normal;
font-size: 10px;
letter-spacing: 0.08em;
text-transform: uppercase;
color: var(--ink-3);
}
.big-vs {
font-size: 30px;
font-style: italic;
color: var(--red);
}
.cd-wrap,
.pred-wrap {
display: grid;
gap: 6px;
}
.top ol {
list-style: none;
margin: 0;
padding: 0;
background: var(--white);
border: var(--rule);
border-top: 0;
}
.top li {
display: grid;
grid-template-columns: 26px auto 1fr auto auto;
gap: 10px;
align-items: center;
padding: 7px 10px;
border-bottom: 1px solid var(--paper-3);
font-size: 14px;
}
.top li:last-child {
border-bottom: 0;
}
.rank {
font-size: 18px;
color: var(--red);
}
.nm {
font-family: var(--f-head);
font-weight: 600;
text-transform: uppercase;
font-size: 13px;
letter-spacing: 0.02em;
}
.elo {
font-weight: 600;
}
.delta {
font-size: 11px;
color: var(--green);
min-width: 30px;
text-align: right;
}
.delta.neg {
color: var(--red);
}
.cta {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 12px 14px;
background: var(--yellow);
transform: rotate(-0.8deg);
}
.cta > span:first-child {
display: grid;
gap: 2px;
}
.cta-h {
font-size: 24px;
}
.cta-sub {
font-size: 12px;
font-style: italic;
}
/* archive */
.grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 16px;
padding: 16px;
background: var(--white);
border: var(--rule);
border-top: 0;
}
.g {
display: grid;
gap: 8px;
transition: transform 0.12s ease;
}
.g:hover {
transform: translateY(-3px) rotate(-0.5deg);
}
.g:hover :global(.thumb) {
box-shadow: var(--hard);
}
.g-meta {
display: grid;
grid-template-columns: auto 1fr;
gap: 2px 10px;
align-items: baseline;
}
.g-res {
grid-row: 1 / 3;
font-size: 22px;
color: var(--red);
align-self: start;
}
.g-res.draw {
color: var(--ink-3);
}
.g-names {
font-size: 13px;
line-height: 1.25;
}
.g-sub {
font-size: 10px;
text-transform: uppercase;
letter-spacing: 0.06em;
color: var(--ink-3);
}
.more {
display: flex;
justify-content: center;
margin-top: 16px;
}
@media (max-width: 1100px) {
.front {
grid-template-columns: 1fr;
}
.grid {
grid-template-columns: repeat(3, 1fr);
}
}
@media (max-width: 760px) {
.feature {
grid-template-columns: 1fr;
}
.f-board :global(.mini) {
width: 100% !important;
height: auto !important;
aspect-ratio: 1;
}
.f-text h1 {
font-size: 36px;
}
.others,
.grid {
grid-template-columns: 1fr;
}
.grid {
grid-template-columns: 1fr 1fr;
gap: 10px;
padding: 10px;
}
}
</style>
@@ -0,0 +1,229 @@
<script lang="ts">
import { USERS, NEXT_MATCH, LIVE_MATCHES, byId } from '#lib/mock';
import { fmtTokens, fmtUsd } from '#lib/game';
import Mark from '#lib/components/Mark.svelte';
const totalCost = USERS.reduce((a, u) => a + u.cost, 0);
const totalTokens = USERS.reduce((a, u) => a + u.tokens, 0);
const scheduled = [
NEXT_MATCH,
{ ...NEXT_MATCH, id: 'sched-2', white: 'gpt-6-astra-max', black: 'u-masha', scheduled: '2026-10-19T19:00:00+03:00', whitePersona: 'Поэт' as const, blackPersona: 'Молчун' as const },
{ ...NEXT_MATCH, id: 'sched-3', white: 'claude-fable-5-1-max', black: 'gpt-6.1-sol-high', scheduled: '2026-10-20T20:00:00+03:00', whitePersona: 'Шут' as const, blackPersona: 'Профессор' as const }
];
</script>
<svelte:head><title>Админка — Вечерний Мат</title></svelte:head>
<div class="adm">
<header class="lead">
<div>
<span class="kicker">Только для редакции</span>
<h1>Кабинет главреда</h1>
</div>
<div class="totals">
<div class="tot"><b class="head">{fmtUsd(totalCost)}</b><span>потрачено всего</span></div>
<div class="tot"><b class="head">{fmtTokens(totalTokens)}</b><span>токенов</span></div>
<div class="tot"><b class="head">{USERS.length}</b><span>пользователей</span></div>
<div class="tot live"><b class="head">{LIVE_MATCHES.length}</b><span>партий в эфире</span></div>
</div>
</header>
<section>
<div class="bar">Пользователи <span class="spacer"></span><small>кто сколько сжёг</small></div>
<div class="clip tbl">
<table>
<thead><tr><th>Пользователь</th><th>Роль</th><th>Партий</th><th>Токены</th><th>$</th><th>Доля</th><th>С нами с</th><th></th></tr></thead>
<tbody>
{#each USERS as u}
{@const p = byId(u.id)}
<tr>
<td><div class="who"><Mark player={p} size={30} /><div><div class="nm">{p.name}</div><div class="mono sub">{p.kind === 'human' ? p.handle : ''} · {p.rating}</div></div></div></td>
<td><span class="chip" class:adm-chip={u.role === 'admin'}>{u.role}</span></td>
<td class="mono">{u.games}</td>
<td class="mono">{fmtTokens(u.tokens)}</td>
<td class="mono money">{fmtUsd(u.cost)}</td>
<td class="share"><span class="track"><i style:width="{(u.cost / totalCost) * 100}%"></i></span><span class="mono">{Math.round((u.cost / totalCost) * 100)}%</span></td>
<td class="mono">{u.joined}</td>
<td class="act"><button class="btn sm">Лимит</button> <button class="btn sm red">Бан</button></td>
</tr>
{/each}
</tbody>
</table>
</div>
</section>
<section>
<div class="bar">Запланированные матчи <span class="spacer"></span><a href="/new"><small>+ запланировать →</small></a></div>
<div class="clip sched">
{#each scheduled as m}
{@const w = byId(m.white)}
{@const b = byId(m.black)}
<div class="s-row">
<span class="mono when">{new Date(m.scheduled!).toLocaleString('ru-RU', { day: '2-digit', month: 'short', hour: '2-digit', minute: '2-digit' })}</span>
<span class="pair"><Mark player={w} size={26} /> <b>{w.name}</b> <em>«{m.whitePersona}»</em> <span class="red">vs</span> <Mark player={b} size={26} /> <b>{b.name}</b> <em>«{m.blackPersona}»</em></span>
<span class="mono votes">{m.predictions.w + m.predictions.d + m.predictions.b} прогнозов</span>
<span class="flags">{#if m.flags.notes}<i>✎</i>{/if}{#if m.flags.tools}<i>⚙</i>{/if}{#if m.flags.cheat}<i class="red">☠</i>{/if}</span>
<span class="act"><button class="btn sm">Изменить</button> <button class="btn sm">Отменить</button></span>
</div>
{/each}
</div>
</section>
</div>
<style>
.adm {
display: grid;
gap: 22px;
}
.lead {
display: flex;
justify-content: space-between;
align-items: flex-end;
gap: 20px;
flex-wrap: wrap;
border-bottom: var(--rule);
padding-bottom: 14px;
}
h1 {
font-size: 56px;
}
.totals {
display: flex;
gap: 10px;
}
.tot {
display: grid;
gap: 2px;
padding: 8px 14px;
border: var(--rule);
background: var(--white);
min-width: 120px;
}
.tot b {
font-size: 28px;
}
.tot span {
font-size: 10px;
text-transform: uppercase;
letter-spacing: 0.1em;
color: var(--ink-3);
}
.tot.live {
background: var(--red);
color: var(--white);
}
.tot.live span {
color: var(--white);
opacity: 0.8;
}
.tbl {
border-top: 0;
overflow-x: auto;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 14px;
}
th {
text-align: left;
font-family: var(--f-head);
text-transform: uppercase;
font-size: 11px;
letter-spacing: 0.12em;
padding: 8px 10px;
background: var(--paper-2);
border-bottom: var(--rule);
}
td {
padding: 8px 10px;
border-bottom: 1px solid var(--paper-3);
vertical-align: middle;
}
.who {
display: flex;
gap: 10px;
align-items: center;
}
.nm {
font-family: var(--f-head);
text-transform: uppercase;
font-weight: 700;
font-size: 15px;
}
.sub {
font-size: 10px;
color: var(--ink-3);
}
.chip {
font-family: var(--f-head);
text-transform: uppercase;
font-size: 10px;
letter-spacing: 0.1em;
padding: 2px 6px;
border: 1.5px solid var(--ink);
}
.adm-chip {
background: var(--yellow);
}
.money {
font-weight: 600;
}
.share {
min-width: 160px;
}
.track {
display: inline-block;
width: 100px;
height: 8px;
border: 1.5px solid var(--ink);
vertical-align: middle;
margin-right: 6px;
background: var(--white);
}
.track i {
display: block;
height: 100%;
background: var(--red);
}
.act {
white-space: nowrap;
text-align: right;
}
.sched {
border-top: 0;
}
.s-row {
display: grid;
grid-template-columns: 110px 1fr auto auto auto;
gap: 14px;
align-items: center;
padding: 10px 12px;
border-bottom: 1px solid var(--paper-3);
}
.when {
font-size: 12px;
font-weight: 600;
}
.pair {
display: flex;
align-items: center;
gap: 6px;
flex-wrap: wrap;
}
.pair b {
font-family: var(--f-head);
text-transform: uppercase;
}
.pair em {
font-size: 12px;
color: var(--ink-3);
}
.votes {
font-size: 11px;
}
.flags i {
font-style: normal;
margin-left: 4px;
}
</style>
@@ -0,0 +1,184 @@
<script lang="ts">
import { RECENT, byId } from '#lib/mock';
import Thumb from '#lib/components/Thumb.svelte';
import Mark from '#lib/components/Mark.svelte';
let q = $state('');
let only = $state<'all' | 'ai' | 'human' | 'cheat'>('all');
const all = [...RECENT, ...RECENT.map((m, i) => ({ ...m, id: m.id + '-b', thumbStyle: (i + 3) % 6 }))];
const list = $derived(
all.filter((m) => {
const w = byId(m.white);
const b = byId(m.black);
const hay = `${w.name} ${b.name} ${m.caption} ${m.reason}`.toLowerCase();
if (q && !hay.includes(q.toLowerCase())) return false;
if (only === 'human') return w.kind === 'human' || b.kind === 'human';
if (only === 'ai') return w.kind === 'ai' && b.kind === 'ai';
if (only === 'cheat') return m.flags.cheat;
return true;
})
);
</script>
<svelte:head><title>Архив — Вечерний Мат</title></svelte:head>
<div class="arch">
<header class="lead">
<div>
<span class="kicker">Архив · все партии · превью генерирует ИИ</span>
<h1>Подшивка</h1>
</div>
<div class="tools">
<input class="search mono" placeholder="поиск: модель, заголовок, причина…" bind:value={q} />
<div class="seg">
{#each [['all', 'Все'], ['ai', 'ИИ vs ИИ'], ['human', 'С людьми'], ['cheat', '☠ Читерские']] as [k, l]}
<button class:on={only === k} onclick={() => (only = k as typeof only)}>{l}</button>
{/each}
</div>
</div>
</header>
<div class="grid">
{#each list as m (m.id)}
{@const w = byId(m.white)}
{@const b = byId(m.black)}
<a class="g" href="/match/demo?over=1">
<Thumb match={m} />
<div class="meta">
<div class="row">
<span class="res head" class:draw={m.result === '½-½'}>{m.result}</span>
<span class="names">
<Mark player={w} size={18} variant="bare" /> <b>{w.name}</b>{w.kind === 'ai' ? ` ${w.variant}` : ''}
<span class="red"> — </span>
<Mark player={b} size={18} variant="bare" /> <b>{b.name}</b>{b.kind === 'ai' ? ` ${b.variant}` : ''}
</span>
</div>
<div class="sub mono">{m.reason} · {Math.ceil((m.plies ?? 0) / 2)} ходов · «{m.whitePersona}» vs «{m.blackPersona}»{m.rated ? '' : ' · без рейтинга'}</div>
</div>
</a>
{/each}
</div>
{#if !list.length}
<p class="empty">Ничего не нашлось. Попробуй «зевнул».</p>
{/if}
</div>
<style>
.arch {
display: grid;
gap: 18px;
}
.lead {
display: flex;
justify-content: space-between;
align-items: flex-end;
gap: 20px;
flex-wrap: wrap;
border-bottom: var(--rule);
padding-bottom: 14px;
}
h1 {
font-size: 64px;
}
.tools {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.search {
border: var(--rule);
background: var(--white);
padding: 8px 12px;
font-size: 13px;
min-width: 300px;
}
.search:focus {
outline: 3px solid var(--yellow);
}
.seg {
display: inline-flex;
border: var(--rule);
background: var(--white);
}
.seg button {
font-family: var(--f-head);
text-transform: uppercase;
font-weight: 600;
font-size: 12px;
letter-spacing: 0.08em;
padding: 8px 12px;
border-right: var(--rule-thin);
}
.seg button:last-child {
border-right: 0;
}
.seg button.on {
background: var(--ink);
color: var(--yellow);
}
.grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 18px;
}
.g {
display: grid;
gap: 8px;
transition: transform 0.12s ease;
}
.g:hover {
transform: translateY(-3px) rotate(-0.5deg);
}
.g:hover :global(.thumb) {
box-shadow: var(--hard);
}
.row {
display: flex;
gap: 10px;
align-items: baseline;
}
.res {
font-size: 22px;
color: var(--red);
}
.res.draw {
color: var(--ink-3);
}
.names {
font-size: 13px;
line-height: 1.3;
}
.names :global(.mark) {
vertical-align: -4px;
}
.sub {
font-size: 10px;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--ink-3);
margin-top: 2px;
}
.empty {
text-align: center;
font-style: italic;
padding: 40px;
}
@media (max-width: 1100px) {
.grid {
grid-template-columns: repeat(3, 1fr);
}
}
@media (max-width: 760px) {
.grid {
grid-template-columns: 1fr 1fr;
gap: 10px;
}
h1 {
font-size: 44px;
}
.search {
min-width: 0;
width: 100%;
}
}
</style>
@@ -0,0 +1,639 @@
<script lang="ts">
import { LEADERBOARD, AI, H2H, byId, type Player } from '#lib/mock';
import { fmtUsd } from '#lib/game';
import Mark from '#lib/components/Mark.svelte';
let view = $state<'table' | 'price' | 'h2h'>('table');
let filter = $state<'all' | 'ai' | 'human'>('all');
const rows = $derived(
LEADERBOARD.map((r) => ({ ...r, p: byId(r.id) }))
.filter((r) => filter === 'all' || r.p.kind === filter)
.sort((a, b) => b.p.rating - a.p.rating)
);
const games = (r: { w: number; d: number; l: number }) => r.w + r.d + r.l;
const score = (r: { w: number; d: number; l: number }) => Math.round(((r.w + r.d / 2) / games(r)) * 100);
// ─── price vs elo scatter ───
const W = 1100;
const H = 440;
const P = { l: 60, r: 40, t: 24, b: 44 };
const minElo = 1500;
const maxElo = 2150;
const maxCost = 12.5;
const sx = (c: number) => P.l + ((W - P.l - P.r) * c) / maxCost;
const sy = (e: number) => P.t + (H - P.t - P.b) * (1 - (e - minElo) / (maxElo - minElo));
const pts = $derived(LEADERBOARD.map((r) => ({ ...r, p: byId(r.id) })));
// "price of a rating point" — linear fit on AI only
const fit = $derived.by(() => {
const a = pts.filter((r) => r.p.kind === 'ai');
const n = a.length;
const mx = a.reduce((s, r) => s + r.cost, 0) / n;
const my = a.reduce((s, r) => s + r.p.rating, 0) / n;
const k = a.reduce((s, r) => s + (r.cost - mx) * (r.p.rating - my), 0) / a.reduce((s, r) => s + (r.cost - mx) ** 2, 0);
return { k, b: my - k * mx };
});
let hover = $state<string | null>(null);
const cellColor = (w: number, l: number) => {
const t = w + l;
if (!t) return 'var(--paper-2)';
const s = w / t;
if (s > 0.62) return 'var(--yellow)';
if (s < 0.38) return 'var(--red)';
return 'var(--white)';
};
const short = (p: Player) => (p.kind === 'ai' ? `${p.family === 'GPT' ? p.name.replace('GPT-', '') : p.name.replace('Claude ', '')} ${p.variant}` : p.name);
</script>
<svelte:head><title>Таблица — Вечерний Мат</title></svelte:head>
<div class="lb">
<header class="lead">
<div>
<span class="kicker">Рейтинг · Elo · люди и нейросети в одной таблице</span>
<h1>Таблица позора<br /><span class="red">и славы</span></h1>
</div>
<p class="deck">
13 участников, 8 из них — токены за деньги. Рейтинг считается по Эло, точность — по Stockfish, а цена — по счёту
от провайдера. Переключись на «Сколько стоит рейтинг», чтобы увидеть, кто платит за каждый пункт Elo больше всех.
</p>
</header>
<div class="toolbar">
<div class="seg">
<button class:on={view === 'table'} onclick={() => (view = 'table')}>Таблица</button>
<button class:on={view === 'price'} onclick={() => (view = 'price')}>$ Сколько стоит рейтинг</button>
<button class:on={view === 'h2h'} onclick={() => (view = 'h2h')}>Кто кого · матрица</button>
</div>
{#if view === 'table'}
<div class="seg small">
<button class:on={filter === 'all'} onclick={() => (filter = 'all')}>Все</button>
<button class:on={filter === 'ai'} onclick={() => (filter = 'ai')}>Нейросети</button>
<button class:on={filter === 'human'} onclick={() => (filter = 'human')}>Люди</button>
</div>
{/if}
</div>
{#if view === 'table'}
<div class="table clip">
<table>
<thead>
<tr>
<th class="n">#</th>
<th class="who">Боец</th>
<th>Elo</th>
<th>7 дн.</th>
<th>Партий</th>
<th class="wdl">W / D / L</th>
<th>Очки</th>
<th>Точность</th>
<th>$ / партия</th>
</tr>
</thead>
<tbody>
{#each rows as r, i}
<tr class:top={i === 0} class:human={r.p.kind === 'human'}>
<td class="n head">{i + 1}</td>
<td class="who">
<div class="who-in">
<Mark player={r.p} size={36} />
<div>
<div class="nm">{r.p.name}</div>
<div class="sub">
{#if r.p.kind === 'ai'}
<span class="chip" class:max={r.p.variant === 'MAX'}>{r.p.variant}</span>
<span class="mono">{r.p.id}</span>
{:else}
<span class="chip hum">человек</span>
<span class="mono">{r.p.handle}</span>
{/if}
</div>
</div>
</div>
</td>
<td class="elo head">{r.p.rating}</td>
<td class="mono delta" class:neg={r.delta < 0}>{r.delta > 0 ? '+' : ''}{r.delta}</td>
<td class="mono">{games(r)}</td>
<td class="wdl">
<span class="wdl-bar">
<i class="w" style:flex={r.w}></i><i class="d" style:flex={r.d}></i><i class="l" style:flex={r.l}></i>
</span>
<span class="mono">{r.w} / {r.d} / {r.l}</span>
</td>
<td class="mono">{score(r)}%</td>
<td class="acc">
<span class="acc-bar"><i style:width="{r.acc}%"></i></span>
<span class="mono">{r.acc.toFixed(1)}%</span>
</td>
<td class="cost mono">{r.cost ? fmtUsd(r.cost) : '—'}</td>
</tr>
{/each}
</tbody>
</table>
</div>
{:else if view === 'price'}
<div class="price clip">
<div class="price-head">
<div>
<span class="kicker">Ось X — средняя цена партии, ось Y — Elo</span>
<h2>Сколько стоит рейтинг</h2>
</div>
<div class="verdict">
<span class="sticker">≈ {fmtUsd(1 / fit.k, 2)} за 1 пункт Elo</span>
<span class="mono">линейная оценка по 8 нейросетям · люди бесплатны, но медленны</span>
</div>
</div>
<svg viewBox="0 0 {W} {H}" role="img" aria-label="Цена против рейтинга">
<!-- grid -->
{#each [1600, 1700, 1800, 1900, 2000, 2100] as e}
<line x1={P.l} x2={W - P.r} y1={sy(e)} y2={sy(e)} stroke="#d8cba9" stroke-width="1" />
<text x={P.l - 8} y={sy(e) + 4} text-anchor="end" class="ax">{e}</text>
{/each}
{#each [0, 2, 4, 6, 8, 10, 12] as c}
<line y1={P.t} y2={H - P.b} x1={sx(c)} x2={sx(c)} stroke="#d8cba9" stroke-width="1" />
<text x={sx(c)} y={H - P.b + 16} text-anchor="middle" class="ax">${c}</text>
{/each}
<text x={W - P.r} y={H - 6} text-anchor="end" class="ax lbl">$ за партию →</text>
<text x={P.l - 46} y={P.t - 8} class="ax lbl">Elo ↑</text>
<!-- fit -->
<line x1={sx(0.5)} y1={sy(fit.b + fit.k * 0.5)} x2={sx(12)} y2={sy(fit.b + fit.k * 12)} stroke="#d1231c" stroke-width="2" stroke-dasharray="6 4" />
<!-- free zone -->
<rect x={P.l} y={P.t} width={sx(0.6) - P.l} height={H - P.t - P.b} fill="#ffd41c" opacity="0.25" />
<text x={P.l + 4} y={P.t + 12} class="ax zone">БЕСПЛАТНО (ЛЮДИ)</text>
<!-- points -->
{#each pts as r}
{@const cx = r.p.kind === 'human' ? sx(0.25) : sx(r.cost)}
{@const cy = sy(r.p.rating)}
{@const big = hover === r.id}
<g
class="pt"
role="button"
tabindex="0"
onmouseenter={() => (hover = r.id)}
onmouseleave={() => (hover = null)}
>
<circle {cx} {cy} r={big ? 16 : 13} fill={r.p.kind === 'human' ? r.p.avatar.bg : r.p.provider === 'openai' ? '#15120f' : '#d97757'} stroke="#15120f" stroke-width="2" />
{#if r.p.kind === 'ai' && r.p.variant === 'MAX'}
<circle {cx} {cy} r={big ? 20 : 17} fill="none" stroke="#15120f" stroke-width="1.5" stroke-dasharray="2 2" />
{/if}
<text x={cx} y={cy + 4} text-anchor="middle" class="pt-txt" fill={r.p.kind === 'human' ? r.p.avatar.fg : '#fff'}>
{r.p.kind === 'human' ? r.p.avatar.initials[0] : r.p.family === 'GPT' ? 'G' : 'C'}
</text>
<text x={r.p.kind === 'human' ? cx : cx + 18} y={r.p.kind === 'human' ? cy + 26 : cy + 4} text-anchor={r.p.kind === 'human' ? 'middle' : 'start'} class="pt-lbl" class:show={big}>{short(r.p)}{big ? ` · ${r.p.rating} · ${r.cost ? fmtUsd(r.cost) : '$0'}` : ''}</text>
</g>
{/each}
</svg>
<div class="price-legend">
<span><i class="dot c"></i>Anthropic</span>
<span><i class="dot o"></i>OpenAI</span>
<span><i class="dot h"></i>Люди</span>
<span><i class="dot ring"></i>MAX-вариант</span>
<span class="muted">наведи на точку</span>
</div>
<div class="takeaways">
<div><b class="head">Самый дорогой пункт</b><span>GPT-6.1 Sol MAX: $11.40 за партию ради 2041. HIGH-версия играет на 123 пункта хуже за четверть цены.</span></div>
<div><b class="head">Лучшая сделка</b><span>Claude Opus 5.5 HIGH: 1962 Elo за $2.60 — дешевле, чем кофе редактора.</span></div>
<div><b class="head">Человек</b><span>@danosito держит 1998 бесплатно. Правда, думает по 6 минут и иногда уходит есть.</span></div>
</div>
</div>
{:else}
<div class="h2h clip">
<div class="price-head">
<div>
<span class="kicker">Строка бьёт столбец · W-D-L с точки зрения строки</span>
<h2>Кто кого</h2>
</div>
<div class="legend-h">
<span><i style:background="var(--yellow)"></i>строка доминирует</span>
<span><i style:background="var(--white)"></i>паритет</span>
<span><i style:background="var(--red)"></i>строку бьют</span>
</div>
</div>
<div class="matrix-wrap">
<table class="matrix">
<thead>
<tr>
<th></th>
{#each AI as c}
<th><div class="colh"><Mark player={c} size={22} /><span>{short(c)}</span></div></th>
{/each}
</tr>
</thead>
<tbody>
{#each AI as r}
<tr>
<th class="rowh"><Mark player={r} size={22} /><span>{short(r)}</span></th>
{#each AI as c}
{#if r.id === c.id}
<td class="self">—</td>
{:else}
{@const [w, d, l] = H2H[r.id][c.id]}
<td style:background={cellColor(w, l)} class:dark={w / (w + l || 1) < 0.38} title="{short(r)} vs {short(c)}: {w}-{d}-{l}">
<b>{w}</b><span>-{d}-</span><b>{l}</b>
</td>
{/if}
{/each}
</tr>
{/each}
</tbody>
</table>
</div>
</div>
{/if}
</div>
<style>
.lb {
display: grid;
gap: 16px;
}
.lead {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 24px;
align-items: end;
border-bottom: var(--rule);
padding-bottom: 14px;
}
.lead h1 {
font-size: 64px;
margin-top: 6px;
}
.deck {
font-size: 16px;
line-height: 1.45;
}
.toolbar {
display: flex;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
}
.seg {
display: inline-flex;
border: var(--rule);
background: var(--white);
box-shadow: 3px 3px 0 var(--ink);
}
.seg button {
font-family: var(--f-head);
text-transform: uppercase;
font-weight: 600;
font-size: 13px;
letter-spacing: 0.08em;
padding: 8px 14px;
border-right: var(--rule-thin);
}
.seg button:last-child {
border-right: 0;
}
.seg button.on {
background: var(--red);
color: var(--white);
}
.seg.small button {
font-size: 11px;
padding: 6px 10px;
}
.seg.small button.on {
background: var(--ink);
color: var(--yellow);
}
/* table */
.table {
overflow-x: auto;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 14px;
}
thead th {
font-family: var(--f-head);
text-transform: uppercase;
font-weight: 600;
font-size: 11px;
letter-spacing: 0.12em;
text-align: left;
padding: 8px 10px;
background: var(--ink);
color: var(--paper);
}
td {
padding: 8px 10px;
border-bottom: 1px solid var(--paper-3);
vertical-align: middle;
}
tr:hover td {
background: var(--paper);
}
tr.top td {
background: var(--yellow);
}
tr.human td {
background-image: repeating-linear-gradient(135deg, transparent 0 14px, rgba(31, 95, 174, 0.06) 14px 16px);
}
.n {
width: 40px;
font-size: 20px;
color: var(--red);
}
.who {
min-width: 260px;
}
.who-in {
display: flex;
align-items: center;
gap: 10px;
}
.nm {
font-family: var(--f-head);
font-weight: 700;
text-transform: uppercase;
font-size: 17px;
line-height: 1;
}
.sub {
display: flex;
gap: 8px;
align-items: center;
margin-top: 3px;
font-size: 10px;
color: var(--ink-3);
}
.chip {
font-family: var(--f-head);
font-weight: 600;
font-size: 9.5px;
letter-spacing: 0.12em;
text-transform: uppercase;
padding: 1px 5px;
border: 1.5px solid var(--ink);
color: var(--ink);
}
.chip.max {
background: var(--yellow);
}
.chip.hum {
background: #1f5fae;
color: #fff;
border-color: #1f5fae;
}
.elo {
font-size: 22px;
}
.delta {
color: var(--green);
font-weight: 600;
}
.delta.neg {
color: var(--red);
}
.wdl {
min-width: 150px;
}
.wdl-bar {
display: flex;
height: 8px;
border: 1.5px solid var(--ink);
margin-bottom: 3px;
width: 120px;
}
.wdl-bar i.w {
background: var(--white);
}
.wdl-bar i.d {
background: repeating-linear-gradient(135deg, var(--ink) 0 2px, var(--paper) 2px 4px);
}
.wdl-bar i.l {
background: var(--ink);
}
.acc-bar {
display: block;
width: 90px;
height: 8px;
border: 1.5px solid var(--ink);
background: var(--white);
margin-bottom: 3px;
}
.acc-bar i {
display: block;
height: 100%;
background: var(--red);
}
.cost {
font-weight: 600;
text-align: right;
}
td.mono,
th:not(.who):not(.wdl) {
font-size: 13px;
}
/* price */
.price,
.h2h {
padding: 16px;
display: grid;
gap: 12px;
}
.price-head {
display: flex;
justify-content: space-between;
align-items: flex-end;
gap: 16px;
flex-wrap: wrap;
}
h2 {
font-size: 36px;
}
.verdict {
display: grid;
gap: 6px;
justify-items: end;
}
.verdict .sticker {
font-size: 16px;
}
.verdict .mono {
font-size: 10px;
color: var(--ink-3);
text-transform: uppercase;
}
svg {
width: 100%;
height: auto;
background: var(--paper);
border: var(--rule);
}
.ax {
font-family: var(--f-mono);
font-size: 10px;
fill: var(--ink-3);
}
.ax.lbl {
fill: var(--ink);
font-weight: 600;
}
.ax.zone {
fill: var(--ink-2);
font-size: 9px;
letter-spacing: 0.1em;
}
.pt {
cursor: pointer;
}
.pt-txt {
font-family: var(--f-head);
font-weight: 700;
font-size: 12px;
pointer-events: none;
}
.pt-lbl {
font-family: var(--f-head);
font-weight: 600;
font-size: 12px;
fill: var(--ink);
opacity: 0.75;
pointer-events: none;
text-transform: uppercase;
paint-order: stroke;
stroke: var(--paper);
stroke-width: 4px;
}
.pt-lbl.show {
opacity: 1;
font-size: 13px;
fill: var(--red);
}
.price-legend {
display: flex;
gap: 16px;
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.08em;
font-family: var(--f-head);
font-weight: 600;
}
.dot {
display: inline-block;
width: 12px;
height: 12px;
border-radius: 50%;
border: 2px solid var(--ink);
vertical-align: -2px;
margin-right: 5px;
}
.dot.c {
background: #d97757;
}
.dot.o {
background: var(--ink);
}
.dot.h {
background: #1f5fae;
}
.dot.ring {
border-style: dashed;
}
.takeaways {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 12px;
}
.takeaways div {
display: grid;
gap: 4px;
padding: 12px;
border: var(--rule);
background: var(--paper);
font-size: 13px;
}
.takeaways b {
font-size: 18px;
color: var(--red);
}
/* h2h */
.legend-h {
display: flex;
gap: 14px;
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.06em;
font-family: var(--f-head);
font-weight: 600;
}
.legend-h i {
display: inline-block;
width: 14px;
height: 14px;
border: 1.5px solid var(--ink);
vertical-align: -3px;
margin-right: 4px;
}
.matrix-wrap {
overflow-x: auto;
}
.matrix {
border: var(--rule);
}
.matrix th,
.matrix td {
border: 1px solid var(--ink);
text-align: center;
padding: 6px;
font-size: 13px;
}
.matrix thead th {
background: var(--paper-2);
color: var(--ink);
vertical-align: bottom;
}
.colh {
display: grid;
justify-items: center;
gap: 4px;
font-size: 10px;
letter-spacing: 0.04em;
}
.rowh {
display: flex;
align-items: center;
gap: 8px;
font-family: var(--f-head);
text-transform: uppercase;
font-size: 12px;
font-weight: 600;
white-space: nowrap;
background: var(--paper-2);
}
.matrix td b {
font-family: var(--f-head);
font-size: 16px;
}
.matrix td span {
font-size: 11px;
opacity: 0.6;
}
.matrix td.dark {
color: var(--white);
}
.matrix td.self {
background: repeating-linear-gradient(45deg, var(--paper-2) 0 4px, var(--paper-3) 4px 8px);
}
@media (max-width: 900px) {
.lead {
grid-template-columns: 1fr;
}
.lead h1 {
font-size: 44px;
}
.takeaways {
grid-template-columns: 1fr;
}
}
</style>
@@ -0,0 +1,240 @@
<script lang="ts">
let mode = $state<'login' | 'register' | 'avatar'>('register');
let name = $state('');
let email = $state('');
let pass = $state('');
let avatarColor = $state('#d1231c');
let avatarData = $state<string | null>(null);
const initials = $derived((name.trim().split(/\s+/).map((w) => w[0]).join('').slice(0, 2) || 'ТЫ').toUpperCase());
function onFile(e: Event) {
const f = (e.target as HTMLInputElement).files?.[0];
if (!f) return;
const r = new FileReader();
r.onload = () => (avatarData = r.result as string);
r.readAsDataURL(f);
}
</script>
<svelte:head><title>Войти — Вечерний Мат</title></svelte:head>
<div class="auth">
<div class="paper clip">
<div class="tabs">
<button class:on={mode === 'login'} onclick={() => (mode = 'login')}>Войти</button>
<button class:on={mode !== 'login'} onclick={() => (mode = 'register')}>Регистрация</button>
</div>
{#if mode === 'login'}
<form onsubmit={(e) => { e.preventDefault(); }}>
<span class="kicker">С возвращением</span>
<h1>Кто там?</h1>
<label>E-mail <input type="email" bind:value={email} placeholder="you@example.com" /></label>
<label>Пароль <input type="password" bind:value={pass} placeholder="••••••••" /></label>
<button class="btn red">Войти →</button>
<p class="fine">Забыл пароль? Бывает. <a href="/login">Восстановить</a>.</p>
</form>
{:else if mode === 'register'}
<form onsubmit={(e) => { e.preventDefault(); mode = 'avatar'; }}>
<span class="kicker">Шаг 1 из 2 · регистрация открыта</span>
<h1>Заведи дело</h1>
<label>Имя (как в таблице) <input bind:value={name} placeholder="Гоша 1600" required /></label>
<label>E-mail <input type="email" bind:value={email} placeholder="you@example.com" required /></label>
<label>Пароль <input type="password" bind:value={pass} placeholder="минимум 8 символов" required /></label>
<button class="btn red">Дальше: фото на документы →</button>
<p class="fine">Регистрируясь, ты соглашаешься, что нейросети будут тебя оскорблять в рамках выбранной персоны.</p>
</form>
{:else}
<form onsubmit={(e) => e.preventDefault()}>
<span class="kicker">Шаг 2 из 2 · аватар</span>
<h1>Фото на обложку</h1>
<div class="mug">
<div class="frame" style:--bg={avatarColor}>
{#if avatarData}
<img src={avatarData} alt="аватар" />
{:else}
<b>{initials}</b>
{/if}
<span class="plate mono">{name || 'БЕЗ ИМЕНИ'} · 1500</span>
</div>
<div class="mug-controls">
<label class="btn">Загрузить файл <input type="file" accept="image/*" onchange={onFile} hidden /></label>
<span class="or">или цвет инициалов</span>
<div class="swatches">
{#each ['#d1231c', '#15120f', '#1f5fae', '#2d7a3a', '#ffd41c', '#d97757'] as c}
<button type="button" class="sw" class:on={avatarColor === c} style:background={c} onclick={() => { avatarColor = c; avatarData = null; }} aria-label={c}></button>
{/each}
</div>
<p class="fine">Аватар попадёт на превью матчей. Выбирай с умом: мем-генератор ничего не прощает.</p>
</div>
</div>
<button class="btn red">Готово, в таблицу →</button>
</form>
{/if}
</div>
<aside class="side">
<div class="sticker">ПОЧЕМУ РЕГИСТРИРОВАТЬСЯ</div>
<ul>
<li><b>Играй против моделей</b> — с персоной «Гопник» или без.</li>
<li><b>Прогнозы за очки</b> — лидерборд предсказателей скоро.</li>
<li><b>Свой матч</b> — выбирай бойцов, флаги, время.</li>
<li><b>Попади в таблицу</b> — люди и ИИ в одном Elo.</li>
</ul>
</aside>
</div>
<style>
.auth {
display: grid;
grid-template-columns: 520px 1fr;
gap: 40px;
align-items: start;
max-width: 900px;
margin: 10px auto 0;
}
.paper {
padding: 0 0 22px;
}
.tabs {
display: flex;
border-bottom: var(--rule);
}
.tabs button {
flex: 1;
padding: 10px;
font-family: var(--f-head);
text-transform: uppercase;
font-weight: 700;
letter-spacing: 0.08em;
}
.tabs button.on {
background: var(--ink);
color: var(--yellow);
}
form {
display: grid;
gap: 14px;
padding: 18px 22px 0;
}
h1 {
font-size: 48px;
margin: -6px 0 4px;
}
label {
display: grid;
gap: 4px;
font-family: var(--f-head);
text-transform: uppercase;
font-size: 11px;
letter-spacing: 0.12em;
font-weight: 600;
}
input:not([type='file']) {
font: 15px var(--f-body);
border: var(--rule);
background: var(--paper);
padding: 9px 12px;
}
input:focus {
outline: 3px solid var(--yellow);
}
.btn {
justify-self: start;
}
.fine {
font-size: 12px;
font-style: italic;
color: var(--ink-2);
}
.fine a {
text-decoration: underline;
}
.mug {
display: grid;
grid-template-columns: auto 1fr;
gap: 18px;
align-items: start;
}
.frame {
width: 160px;
height: 190px;
border: 3px solid var(--ink);
background: var(--bg);
display: grid;
place-items: center;
position: relative;
overflow: hidden;
background-image: repeating-linear-gradient(0deg, transparent 0 22px, rgba(255, 255, 255, 0.25) 22px 23px);
}
.frame img {
width: 100%;
height: 100%;
object-fit: cover;
filter: contrast(1.15) grayscale(0.3);
}
.frame b {
font-family: var(--f-head);
font-size: 64px;
color: var(--white);
text-shadow: 3px 3px 0 var(--ink);
}
.plate {
position: absolute;
bottom: 8px;
left: 8px;
right: 8px;
background: var(--white);
border: 1.5px solid var(--ink);
font-size: 10px;
text-align: center;
padding: 2px;
text-transform: uppercase;
}
.mug-controls {
display: grid;
gap: 10px;
}
.or {
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.1em;
color: var(--ink-3);
}
.swatches {
display: flex;
gap: 8px;
}
.sw {
width: 28px;
height: 28px;
border: 2px solid var(--ink);
}
.sw.on {
outline: 3px solid var(--yellow);
}
.side {
padding-top: 30px;
}
.side ul {
margin: 18px 0 0;
padding: 0;
list-style: none;
display: grid;
gap: 10px;
font-size: 15px;
}
.side li {
padding-left: 16px;
border-left: 3px solid var(--red);
}
.side b {
font-family: var(--f-head);
text-transform: uppercase;
font-size: 15px;
}
@media (max-width: 900px) {
.auth {
grid-template-columns: 1fr;
}
}
</style>
@@ -0,0 +1,785 @@
<script lang="ts">
import { page } from '$app/state';
import { onMount } from 'svelte';
import { DEMO, PLIES, byId } from '#lib/mock';
import { replay, accuracy, fmtUsd, fmtTokens, moveNo, evalLabel } from '#lib/game';
import Board from '#lib/components/Board.svelte';
import EvalBar from '#lib/components/EvalBar.svelte';
import EvalGraph from '#lib/components/EvalGraph.svelte';
import PlayerCard from '#lib/components/PlayerCard.svelte';
import MoveList from '#lib/components/MoveList.svelte';
import TalkFeed from '#lib/components/TalkFeed.svelte';
import Predictions from '#lib/components/Predictions.svelte';
import Thumb from '#lib/components/Thumb.svelte';
import Mark from '#lib/components/Mark.svelte';
const over = $derived(page.url.searchParams.get('over') === '1');
const match = $derived({ ...DEMO, status: over ? ('over' as const) : ('live' as const), result: over ? ('0-1' as const) : undefined, reason: over ? 'мат' : undefined });
const plies = $derived(over ? PLIES : PLIES.slice(0, 43));
const positions = $derived(replay(plies));
const white = byId(DEMO.white);
const black = byId(DEMO.black);
let current = $state(43);
let expanded = $state<number | null>(null);
let showArrow = $state(true);
let flipped = $state(false);
let tab = $state<'moves' | 'talk' | 'graph' | 'bets' | 'cost'>('moves');
$effect(() => {
current = plies.length;
});
onMount(() => {
if (page.url.searchParams.get('think')) {
expanded = +page.url.searchParams.get('think')!;
current = expanded;
}
});
const pos = $derived(positions[current]);
const last = $derived(current > 0 ? plies[current - 1] : undefined);
const atLive = $derived(current === plies.length);
const toMove = $derived(current % 2 === 0 ? 'w' : 'b');
const liveToMove = $derived(plies.length % 2 === 0 ? 'w' : 'b');
// thinking clock for the side to move (live only)
let thinkSec = $state(107);
onMount(() => {
const t = setInterval(() => (thinkSec += 1), 1000);
return () => clearInterval(t);
});
const sum = (c: 'w' | 'b', k: 'cost' | 'tokens') => plies.filter((p) => p.color === c).reduce((a, p) => a + p[k], 0);
const accW = $derived(accuracy(plies.slice(0, current), 'w'));
const accB = $derived(accuracy(plies.slice(0, current), 'b'));
const costW = $derived(sum('w', 'cost'));
const costB = $derived(sum('b', 'cost'));
// best-move arrow (mock engine): suggestions per position index
const BEST: Record<number, [string, string]> = {
43: ['e6', 'g6'],
41: ['h3', 'g4'],
44: ['g1', 'h2'],
45: ['c6', 'd4'],
46: ['c3', 'd4'],
47: ['d4', 'f3'],
48: ['h2', 'h1'],
49: ['g6', 'g1'],
42: ['g2', 'h3'],
40: ['e4', 'e3']
};
const arrow = $derived(showArrow && !over ? (BEST[current] ?? null) : null);
// rule-state banners the agent would see
const rule = $derived.by(() => {
if (current === 35 || current === 36) return { kind: 'rep', text: 'Эта позиция уже встречалась дважды — ещё раз, и ничья по повторению' };
return null;
});
const halfmoveClock = $derived(current >= 43 ? current - 43 : current >= 33 ? current - 33 : 0);
const headline = $derived(
over
? 'Гопник поставил мат Профессору'
: current >= 42
? 'Конь улетел на h3. Профессор взял. Зря?'
: 'Профессор против гопника'
);
const sub = $derived(
over
? '25 ходов, две жертвы коня и один зевок за 4 минуты. Ладья на g1 — занавес.'
: 'Итальянская партия, 22-й ход. Белые приняли жертву — Stockfish пока на их стороне.'
);
function go(n: number) {
current = Math.max(0, Math.min(plies.length, n));
}
function key(e: KeyboardEvent) {
if (e.key === 'ArrowLeft') go(current - 1);
if (e.key === 'ArrowRight') go(current + 1);
if (e.key === 'Home') go(0);
if (e.key === 'End') go(plies.length);
}
</script>
<svelte:window onkeydown={key} />
<svelte:head><title>{over ? 'МАТ! ' : 'LIVE · '}{white.name} — {black.name} · Вечерний Мат</title></svelte:head>
<div class="match" class:over>
<!-- ───── headline ───── -->
<section class="lead">
<div class="lead-left">
<div class="stickers">
{#if over}
<span class="sticker ink">Итог: 0–1</span>
<span class="sticker red">МАТ НА 25-М</span>
{:else}
<span class="sticker red"><span class="live-dot"></span> LIVE</span>
<span class="sticker">Ход {Math.ceil((plies.length + 1) / 2)} · {liveToMove === 'w' ? 'белые' : 'чёрные'} думают</span>
{/if}
{#if match.flags.notes}<span class="sticker white flat">✎ Заметки себе</span>{/if}
{#if match.flags.tools}<span class="sticker white flat">⚙ Доп. тулы</span>{/if}
{#if match.flags.cheat}<span class="sticker red">☠ Читерство · без рейтинга</span>{:else}<span class="sticker white flat">Рейтинговая</span>{/if}
</div>
<h1>{headline}</h1>
<p class="deck">{sub}</p>
</div>
{#if over}
<a class="lead-thumb" href="/games"><Thumb match={{ ...match, caption: DEMO.caption, thumbStyle: 0 }} fen={positions.at(-1)!.fen} /></a>
{/if}
</section>
<!-- ───── mobile tabs ───── -->
<div class="tabs">
{#each [['moves', 'Ходы'], ['talk', 'Трёп'], ['graph', 'График'], ['bets', 'Ставки'], ['cost', 'Счётчик']] as [k, l]}
<button class:on={tab === k} onclick={() => (tab = k as typeof tab)}>{l}</button>
{/each}
</div>
<div class="grid">
<!-- ───── left: players + talk ───── -->
<aside class="col-left">
<div class="players">
<PlayerCard
player={flipped ? white : black}
color={flipped ? 'w' : 'b'}
persona={flipped ? DEMO.whitePersona : DEMO.blackPersona}
accuracy={flipped ? accW : accB}
cost={flipped ? costW : costB}
tokens={flipped ? sum('w', 'tokens') : sum('b', 'tokens')}
thinking={!over && liveToMove === (flipped ? 'w' : 'b')}
{thinkSec}
result={over ? (flipped ? 'loss' : 'win') : undefined}
/>
<PlayerCard
player={flipped ? black : white}
color={flipped ? 'b' : 'w'}
persona={flipped ? DEMO.blackPersona : DEMO.whitePersona}
accuracy={flipped ? accB : accW}
cost={flipped ? costB : costW}
tokens={flipped ? sum('b', 'tokens') : sum('w', 'tokens')}
thinking={!over && liveToMove === (flipped ? 'b' : 'w')}
{thinkSec}
result={over ? (flipped ? 'win' : 'loss') : undefined}
/>
</div>
<div class="panel talk" class:on={tab === 'talk'}>
<div class="bar red">Цитаты с ринга <span class="spacer"></span><small>трэш-ток</small></div>
<TalkFeed {plies} {white} {black} {current} onpick={(n) => { go(n); expanded = n; }} />
</div>
</aside>
<!-- ───── center: board ───── -->
<section class="col-board">
{#if rule}
<div class="rule-banner">
<span class="sticker red flat">⚠ Повторение</span>
<span>{rule.text}</span>
</div>
{:else if !over && atLive}
<div class="rule-banner calm">
<span class="mono">агент видит:</span>
<span>рокировок нет · 50 ходов: <b>{halfmoveClock}/100</b> · повторений: <b>0</b></span>
</div>
{:else if over && current === plies.length}
<div class="rule-banner mate">
<span class="sticker ink">#</span>
<span><b>Мат.</b> Чёрные выиграли. Ладья g1, король h1, больше ничего не нужно.</span>
</div>
{:else}
<div class="rule-banner calm">
<span class="mono">просмотр:</span>
<span>{last ? `${moveNo(current)} ${last.san} · оценка ${evalLabel(last)}` : 'начальная позиция'}</span>
<button class="btn sm" onclick={() => go(plies.length)}>→ к последнему ходу</button>
</div>
{/if}
<div class="board-row">
<EvalBar cp={last?.eval ?? 20} mate={last?.mate} orientation={flipped ? 'black' : 'white'} />
<div class="board-wrap">
<Board fen={pos.fen} lastMove={pos.lastMove} check={pos.check} orientation={flipped ? 'black' : 'white'} {arrow} />
</div>
</div>
<div class="controls">
<div class="nav">
<button onclick={() => go(0)} title="В начало">⏮</button>
<button onclick={() => go(current - 1)} title="Назад">◀</button>
<span class="pos mono">{current > 0 ? `${moveNo(current)} ${last?.san}` : 'start'} <i>/ {plies.length}</i></span>
<button onclick={() => go(current + 1)} title="Вперёд">▶</button>
<button onclick={() => go(plies.length)} title="В конец">⏭</button>
</div>
<div class="toggles">
<button class="tg" class:on={showArrow} onclick={() => (showArrow = !showArrow)} disabled={over}>→ Лучший ход</button>
<button class="tg" onclick={() => (flipped = !flipped)}>⟲ Перевернуть</button>
</div>
</div>
<div class="panel graph" class:on={tab === 'graph'}>
<div class="bar">Stockfish · график оценки <span class="spacer"></span><small>глубина 24</small></div>
<EvalGraph {plies} {current} onselect={go} />
</div>
</section>
<!-- ───── right: moves + bets + cost ───── -->
<aside class="col-right">
<div class="panel moves" class:on={tab === 'moves'} class:expanded={expanded !== null}>
<div class="bar">
Ходы
<span class="spacer"></span>
<small>★ лучший · ?! неточность · ? ошибка · ?? зевок · 💭 мысли</small>
</div>
<MoveList {plies} {current} {expanded} {white} {black} onselect={go} onexpand={(n) => (expanded = n)} />
</div>
<div class="panel bets" class:on={tab === 'bets'}>
<div class="bar">Прогноз трибун <span class="spacer"></span><small>{over ? 'итог: чёрные' : 'закрыт на старте'}</small></div>
<div class="boxed"><Predictions {match} locked compact /></div>
</div>
<div class="panel cost" class:on={tab === 'cost'}>
<div class="bar">Счётчик <span class="spacer"></span><small>токены и $ за партию</small></div>
<div class="boxed costs">
{#each [{ p: white, c: costW, t: sum('w', 'tokens'), cls: 'w' }, { p: black, c: costB, t: sum('b', 'tokens'), cls: 'b' }] as r}
<div class="cost-row">
<Mark player={r.p} size={24} />
<span class="cost-name">{r.p.name}</span>
<span class="mono">{fmtTokens(r.t)}</span>
<b class="head">{fmtUsd(r.c)}</b>
</div>
<div class="cost-track"><span class="cost-fill {r.cls}" style:width="{(r.c / Math.max(costW, costB)) * 100}%"></span></div>
{/each}
<div class="cost-total">
<span>Итого за партию</span>
<b class="head">{fmtUsd(costW + costB)}</b>
</div>
<p class="cost-note">≈ {fmtUsd((costW + costB) / plies.length, 3)} за ход · самый дорогой ход: 24. Nf1 ({fmtUsd(PLIES[46].cost, 2)}, 4 мин) — и это был зевок.</p>
</div>
</div>
</aside>
</div>
{#if over}
<section class="presser">
<div class="bar red">Пресс-конференция <span class="spacer"></span><small>после партии · без подготовки</small></div>
<div class="presser-grid">
{#each [{ p: black, text: DEMO.interviews!.black, persona: DEMO.blackPersona, res: 'ПОБЕДИТЕЛЬ' }, { p: white, text: DEMO.interviews!.white, persona: DEMO.whitePersona, res: 'ПРОИГРАВШИЙ' }] as iv}
<article class="iv">
<div class="iv-head">
<Mark player={iv.p} size={72} />
<div>
<div class="head iv-name">{iv.p.name}</div>
<div class="mono iv-meta">🎤 {iv.res} · «{iv.persona}»</div>
</div>
</div>
<blockquote>{iv.text}</blockquote>
</article>
{/each}
</div>
</section>
{/if}
</div>
<style>
.match {
display: grid;
gap: 14px;
}
/* headline */
.lead {
display: grid;
grid-template-columns: 1fr;
gap: 20px;
align-items: end;
border-bottom: var(--rule);
padding-bottom: 14px;
}
.over .lead {
grid-template-columns: 1fr 380px;
}
.lead {
padding-bottom: 10px;
}
.stickers {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-bottom: 10px;
}
.stickers .sticker {
font-size: 11px;
}
.lead h1 {
font-size: clamp(32px, 3.6vw, 50px);
max-width: 30ch;
}
.over .lead h1 {
font-size: clamp(36px, 4.4vw, 64px);
}
.deck {
margin-top: 6px;
font-size: 15px;
font-style: italic;
max-width: 80ch;
}
.lead-thumb {
display: block;
transform: rotate(1.5deg);
box-shadow: var(--hard);
}
/* tabs (mobile only) */
.tabs {
display: none;
}
.grid {
display: grid;
grid-template-columns: 300px minmax(0, 1fr) 400px;
gap: 18px;
align-items: start;
}
.col-left,
.col-right {
display: grid;
gap: 14px;
}
.players {
display: grid;
gap: 14px;
}
.col-board {
display: grid;
gap: 10px;
}
.col-board {
--bw: min(100%, 524px);
}
.board-row {
display: grid;
grid-template-columns: 22px minmax(0, 1fr);
gap: 12px;
align-items: stretch;
width: var(--bw);
margin: 0 auto;
}
.board-wrap {
width: 100%;
}
.rule-banner,
.controls,
.panel.graph {
width: calc(var(--bw) - 34px);
margin-left: auto;
margin-right: auto;
transform: translateX(17px);
}
.rule-banner {
display: flex;
align-items: center;
gap: 10px;
padding: 6px 10px;
background: var(--yellow);
border: var(--rule);
font-size: 14px;
font-weight: 600;
}
.rule-banner.calm {
background: var(--white);
font-weight: 400;
font-size: 13px;
}
.rule-banner.calm .mono {
font-size: 10px;
text-transform: uppercase;
letter-spacing: 0.1em;
color: var(--red);
}
.rule-banner.calm .btn {
margin-left: auto;
}
.rule-banner.mate {
background: var(--ink);
color: var(--paper);
}
.rule-banner .sticker.flat {
font-size: 11px;
}
.controls {
display: flex;
justify-content: space-between;
align-items: center;
gap: 10px;
flex-wrap: wrap;
}
.nav {
display: inline-flex;
border: var(--rule);
background: var(--white);
}
.nav button {
padding: 6px 12px;
border-right: var(--rule-thin);
font-size: 13px;
}
.nav button:hover {
background: var(--ink);
color: var(--paper);
}
.nav .pos {
padding: 6px 12px;
border-right: var(--rule-thin);
font-size: 12px;
font-weight: 600;
min-width: 120px;
text-align: center;
}
.nav .pos i {
font-style: normal;
opacity: 0.5;
}
.nav button:last-child {
border-right: 0;
}
.toggles {
display: flex;
gap: 8px;
}
.tg {
font-family: var(--f-head);
text-transform: uppercase;
font-weight: 600;
font-size: 11px;
letter-spacing: 0.08em;
padding: 6px 10px;
border: var(--rule);
background: var(--white);
}
.tg.on {
background: var(--red);
color: var(--white);
}
.tg:disabled {
opacity: 0.4;
}
.panel.moves :global(.moves) {
max-height: 450px;
}
.panel.moves.expanded :global(.moves) {
max-height: 800px;
}
.panel.talk :global(.feed) {
max-height: 520px;
}
.boxed {
background: var(--white);
border: var(--rule);
border-top: 0;
padding: 10px;
}
.costs {
display: grid;
gap: 6px;
}
.cost-row {
display: grid;
grid-template-columns: auto 1fr auto auto;
gap: 10px;
align-items: center;
font-size: 13px;
}
.cost-row .mono {
font-size: 11px;
opacity: 0.7;
}
.cost-row b {
font-size: 20px;
}
.cost-track {
height: 8px;
border: 1.5px solid var(--ink);
background: var(--paper);
margin-bottom: 4px;
}
.cost-fill {
display: block;
height: 100%;
background: var(--red);
}
.cost-fill.b {
background: var(--ink);
}
.cost-total {
display: flex;
justify-content: space-between;
align-items: baseline;
border-top: var(--rule);
padding-top: 6px;
margin-top: 4px;
font-family: var(--f-head);
text-transform: uppercase;
font-size: 12px;
letter-spacing: 0.1em;
}
.cost-total b {
font-size: 26px;
}
.cost-note {
font-size: 12px;
font-style: italic;
color: var(--ink-2);
}
/* press conference */
.presser {
margin-top: 10px;
}
.presser-grid {
display: grid;
grid-template-columns: 1fr 1fr;
border: var(--rule);
border-top: 0;
background: var(--white);
}
.iv {
padding: 22px 28px 26px;
display: grid;
grid-template-columns: 220px 1fr;
gap: 20px;
align-items: start;
}
.iv + .iv {
border-left: var(--rule);
}
.iv-head {
display: grid;
gap: 10px;
justify-items: start;
}
.iv-name {
font-size: 26px;
}
.iv-meta {
font-size: 10px;
letter-spacing: 0.08em;
text-transform: uppercase;
color: var(--red);
margin-top: 4px;
}
blockquote {
margin: 0;
font-size: 18px;
line-height: 1.45;
position: relative;
padding-left: 30px;
}
blockquote::before {
content: '«';
position: absolute;
left: -4px;
top: -18px;
font-family: var(--f-head);
font-size: 64px;
color: var(--red);
line-height: 1;
}
/* ───── responsive ───── */
@media (max-width: 1180px) {
.grid {
grid-template-columns: 260px minmax(0, 1fr) 340px;
gap: 12px;
}
}
@media (max-width: 960px) {
.lead,
.over .lead {
grid-template-columns: 1fr;
}
.lead h1 {
font-size: 28px;
}
.deck {
display: none;
}
.stickers .sticker.flat:not(.red) {
display: none;
}
.lead {
padding-bottom: 8px;
}
.stickers {
gap: 6px;
margin-bottom: 10px;
}
.stickers .sticker {
font-size: 10px;
padding: 4px 7px;
}
.lead-thumb {
transform: none;
}
.match {
gap: 10px;
grid-template-columns: minmax(0, 1fr);
}
.match > *,
.panel,
.players,
.board-row {
min-width: 0;
max-width: 100%;
}
.tabs {
overflow-x: auto;
}
.tabs button {
white-space: nowrap;
}
.lead h1 {
overflow-wrap: anywhere;
}
.grid,
.col-left,
.col-right,
.col-board {
display: contents;
}
.lead {
order: 0;
}
.rule-banner {
order: 1;
}
.board-row {
order: 2;
}
.controls {
order: 3;
}
.players {
order: 4;
}
.tabs {
order: 5;
}
.panel {
order: 6;
}
.presser {
order: 7;
}
.players {
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
gap: 8px;
}
.players :global(.card .stats) {
grid-template-columns: 1fr 1fr;
}
.players :global(.card .stat.money) {
display: none;
}
.players :global(.card .stat span) {
font-size: 8px;
letter-spacing: 0.04em;
}
.players :global(.card .meta .rating) {
font-size: 12px;
}
.players :global(.card .chip) {
font-size: 9px;
padding: 1px 4px;
}
.players :global(.card .persona) {
display: none;
}
.players :global(.card .name) {
font-size: 17px;
}
.players :global(.card .stat b) {
font-size: 15px;
}
.players :global(.card .stat) {
padding: 6px 8px;
}
.players :global(.card .top) {
padding: 8px;
}
.board-row {
grid-template-columns: 16px minmax(0, 1fr);
gap: 8px;
}
.board-row :global(.bar) {
width: 16px;
}
.col-board {
--bw: 100%;
}
.rule-banner,
.controls,
.panel.graph {
width: 100%;
transform: none;
}
.iv {
grid-template-columns: 1fr;
padding: 14px;
}
.tabs {
display: flex;
border: var(--rule);
background: var(--white);
position: sticky;
top: 0;
z-index: 5;
}
.tabs button {
flex: 1;
padding: 9px 4px;
font-family: var(--f-head);
text-transform: uppercase;
font-weight: 600;
font-size: 12px;
letter-spacing: 0.06em;
border-right: var(--rule-thin);
}
.tabs button:last-child {
border-right: 0;
}
.tabs button.on {
background: var(--ink);
color: var(--yellow);
}
.panel {
display: none;
}
.panel.on {
display: block;
}
.panel.moves :global(.moves),
.panel.moves.expanded :global(.moves) {
max-height: 440px;
}
.panel.talk :global(.feed) {
max-height: 520px;
}
.panel .bar small {
display: none;
}
.presser-grid {
grid-template-columns: 1fr;
}
.iv + .iv {
border-left: 0;
border-top: var(--rule);
}
.rule-banner {
font-size: 12px;
flex-wrap: wrap;
}
.rule-banner.calm .btn {
margin-left: 0;
}
}
</style>
+326
View File
@@ -0,0 +1,326 @@
<script lang="ts">
import { AI, HUMANS, PERSONAS, byId, type Persona } from '#lib/mock';
import Mark from '#lib/components/Mark.svelte';
const me = HUMANS[0];
const options = [me, ...AI];
let white = $state('gpt-6.1-sol-max');
let black = $state('claude-opus-5-5-max');
let wp = $state<Persona>('Профессор');
let bp = $state<Persona>('Уличный гопник');
let notes = $state(true);
let tools = $state(false);
let cheat = $state(false);
let schedule = $state(false);
const est = $derived.by(() => {
const w = byId(white);
const b = byId(black);
const per = (p: typeof w) => (p.kind === 'ai' ? (p.variant === 'MAX' ? 5.2 : 1.4) : 0) * (tools ? 1.6 : 1);
return per(w) + per(b);
});
const headline = $derived(`${byId(white).name} «${wp}» против ${byId(black).name} «${bp}»`);
</script>
<svelte:head><title>Новый матч — Вечерний Мат</title></svelte:head>
<div class="nm">
<header class="lead">
<span class="kicker">Редакция заказывает бой</span>
<h1>Новый матч</h1>
<p class="deck">Выбери бойцов, персоны и экспериментальные флаги. Всё, что помечено ☠, снимает партию с рейтинга.</p>
</header>
<div class="cols">
<form class="form" onsubmit={(e) => e.preventDefault()}>
{#each [{ side: 'w', label: 'Белые', val: white, pv: wp }, { side: 'b', label: 'Чёрные', val: black, pv: bp }] as s}
<fieldset class="side {s.side}">
<legend class="bar">{s.side === 'w' ? '♔' : '♚'} {s.label}</legend>
<div class="pick">
{#each options as o}
<button
type="button"
class="opt"
class:on={s.val === o.id}
onclick={() => (s.side === 'w' ? (white = o.id) : (black = o.id))}
>
<Mark player={o} size={34} />
<span class="o-name">{o.kind === 'human' ? 'Я сам' : o.name}</span>
<span class="o-sub mono">{o.kind === 'human' ? o.handle : o.variant}{o.kind === 'ai' && o.variant === 'HIGH' ? ' · быстрый' : ''} · {o.rating}</span>
</button>
{/each}
</div>
<div class="personas">
<span class="kicker">Персона</span>
<div class="p-grid">
{#each PERSONAS as p}
<button
type="button"
class="persona"
class:on={s.pv === p.id}
onclick={() => (s.side === 'w' ? (wp = p.id) : (bp = p.id))}
>
<b class="head">{p.id}</b>
<span>{p.blurb}</span>
<em>{p.sample}</em>
</button>
{/each}
</div>
</div>
</fieldset>
{/each}
<fieldset class="flags">
<legend class="bar red">Экспериментальные флаги</legend>
<label class="flag"><input type="checkbox" bind:checked={notes} /><span><b>✎ Заметки себе</b> — агент может оставить записку на следующий ход. Память появляется, но крошечная.</span></label>
<label class="flag"><input type="checkbox" bind:checked={tools} /><span><b>⚙ Доп. тулы</b> — <code class="mono">get_move_history</code> и <code class="mono">python</code> с python-chess. Дороже примерно в 1.6 раза.</span></label>
<label class="flag danger" class:on={cheat}>
<input type="checkbox" bind:checked={cheat} />
<span><b>☠ Читерство</b> — нелегальные ходы разрешены. <strong>Партия без рейтинга</strong>, помечается на всех страницах. Для науки.</span>
{#if cheat}<span class="sticker red">БЕЗ РЕЙТИНГА</span>{/if}
</label>
<label class="flag"><input type="checkbox" bind:checked={schedule} /><span><b>🕗 Запланировать</b> — показать на главной с обратным отсчётом и открыть прогнозы.</span></label>
{#if schedule}
<div class="when"><span class="kicker">Когда</span><input class="mono" type="datetime-local" value="2026-10-18T21:30" /></div>
{/if}
</fieldset>
</form>
<aside class="preview">
<div class="bar">Афиша</div>
<div class="poster clip">
<span class="sticker">{schedule ? 'АНОНС' : 'СЕЙЧАС'}</span>
<div class="p-vs">
<Mark player={byId(white)} size={72} />
<span class="head vs">VS</span>
<Mark player={byId(black)} size={72} />
</div>
<h2>{headline}</h2>
<ul class="mono">
<li>заметки: {notes ? 'да' : 'нет'}</li>
<li>доп. тулы: {tools ? 'да' : 'нет'}</li>
<li>читерство: {cheat ? 'ДА · без рейтинга' : 'нет'}</li>
<li>оценка стоимости: ≈ ${est.toFixed(2)}</li>
</ul>
<button class="btn red big">{schedule ? 'Запланировать' : 'Начать бой'} →</button>
<p class="fine">Белые ходят первыми. Оба получают свежий контекст на каждом ходу. Stockfish смотрит за всеми.</p>
</div>
</aside>
</div>
</div>
<style>
.nm {
display: grid;
gap: 18px;
}
.lead {
border-bottom: var(--rule);
padding-bottom: 14px;
}
h1 {
font-size: 64px;
margin: 4px 0 6px;
}
.deck {
font-size: 16px;
max-width: 70ch;
}
.cols {
display: grid;
grid-template-columns: minmax(0, 1fr) 360px;
gap: 20px;
align-items: start;
}
.form {
display: grid;
gap: 18px;
}
fieldset {
border: var(--rule);
padding: 0 0 12px;
margin: 0;
background: var(--white);
}
legend {
margin-left: -2px;
padding: 5px 12px;
}
.pick {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 8px;
padding: 12px;
}
.opt {
display: grid;
grid-template-columns: auto 1fr;
gap: 0 10px;
text-align: left;
align-items: center;
padding: 8px;
border: 1.5px solid var(--ink);
background: var(--paper);
}
.opt :global(.mark) {
grid-row: 1 / 3;
}
.opt.on {
background: var(--yellow);
box-shadow: 3px 3px 0 var(--ink);
}
.o-name {
font-family: var(--f-head);
font-weight: 700;
text-transform: uppercase;
font-size: 14px;
}
.o-sub {
font-size: 10px;
color: var(--ink-3);
}
.personas {
padding: 0 12px;
display: grid;
gap: 6px;
}
.p-grid {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 8px;
}
.persona {
display: grid;
gap: 4px;
text-align: left;
padding: 10px;
border: 1.5px solid var(--ink);
background: var(--paper);
font-size: 11.5px;
line-height: 1.3;
}
.persona b {
font-size: 15px;
}
.persona em {
color: var(--ink-3);
font-size: 11px;
}
.persona.on {
background: var(--ink);
color: var(--paper);
}
.persona.on em {
color: var(--yellow);
}
.flags {
display: grid;
gap: 10px;
padding: 0 12px 12px;
}
.flag {
display: flex;
gap: 12px;
align-items: flex-start;
font-size: 14px;
padding: 8px;
border: 1.5px solid var(--paper-3);
cursor: pointer;
}
.flag input {
width: 20px;
height: 20px;
accent-color: var(--red);
margin-top: 2px;
}
.flag code {
font-size: 12px;
background: var(--paper-2);
padding: 0 4px;
}
.flag.danger {
border-color: var(--red);
background: #fbeae9;
position: relative;
}
.flag.danger.on {
background: var(--red);
color: var(--white);
}
.flag.danger .sticker {
position: absolute;
right: 12px;
top: -12px;
font-size: 11px;
}
.when {
display: flex;
gap: 12px;
align-items: center;
}
.when input {
border: var(--rule);
padding: 6px 10px;
background: var(--white);
}
.poster {
padding: 18px;
display: grid;
gap: 12px;
border-top: 0;
position: relative;
}
.poster .sticker {
position: absolute;
right: -10px;
top: -12px;
}
.p-vs {
display: flex;
align-items: center;
justify-content: center;
gap: 16px;
}
.vs {
font-size: 28px;
font-style: italic;
color: var(--red);
}
h2 {
font-size: 26px;
text-align: center;
}
ul {
margin: 0;
padding: 10px;
list-style: none;
background: var(--paper);
border: 1px solid var(--paper-3);
font-size: 12px;
display: grid;
gap: 3px;
}
.big {
font-size: 18px;
padding: 14px;
}
.fine {
font-size: 12px;
font-style: italic;
color: var(--ink-2);
}
@media (max-width: 1000px) {
.cols {
grid-template-columns: 1fr;
}
.pick {
grid-template-columns: 1fr 1fr;
}
.p-grid {
grid-template-columns: 1fr 1fr;
}
h1 {
font-size: 44px;
}
}
</style>