Новогодний квиз: ядро, сервер и три экрана

- ядро: контент, reducer всех фаз, undo, проекции по ролям
- сервер: комнаты, сокеты, таймеры, раздача интерфейса и медиа
- интерфейс: табло, пульт ведущего, телефон игрока
- контент: пак 5x5 с финалом и демо-пак с рабочим аудио
- 57 тестов и e2e на трёх вкладках
This commit is contained in:
oskarvitalii committed 2026-11-16 14:32:08 +07:00
commit 89eeea4855
54 files changed
+12010

No files matched your search

+876
View File
@@ -0,0 +1,876 @@
/* Оформление рассчитано на проектор: крупный шрифт, высокий контраст,
никакой прокрутки на табло. Размеры привязаны к vmin, а не к пикселям. */
:root {
--bg: #080d1f;
--panel: rgba(255, 255, 255, 0.045);
--gold: #e9c46a;
--gold-soft: rgba(233, 196, 106, 0.16);
--text: #f6f2e7;
--muted: #98a2c0;
--ok: #48b98a;
--bad: #e2675f;
--line: rgba(233, 196, 106, 0.22);
--radius: 14px;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
html,
body,
#app {
height: 100%;
margin: 0;
}
body {
font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
color: var(--text);
background:
radial-gradient(1100px 700px at 50% -15%, #1d3170 0%, transparent 60%),
radial-gradient(800px 600px at 88% 110%, #3b1f4a 0%, transparent 55%),
var(--bg);
background-attachment: fixed;
-webkit-font-smoothing: antialiased;
}
button {
font: inherit;
color: inherit;
cursor: pointer;
border: 0;
background: none;
}
button:disabled {
cursor: default;
}
input {
font: inherit;
color: var(--text);
background: rgba(0, 0, 0, 0.28);
border: 1px solid var(--line);
border-radius: 10px;
padding: 0.45em 0.7em;
}
input:focus {
outline: 2px solid rgba(233, 196, 106, 0.45);
outline-offset: 1px;
}
/* ─── Каркас ─────────────────────────────────────────────────────────── */
.shell {
min-height: 100%;
display: flex;
flex-direction: column;
gap: clamp(0.5rem, 1.5vmin, 1rem);
padding: clamp(0.75rem, 2vmin, 1.75rem);
}
.topbar {
display: flex;
align-items: center;
gap: 0.9rem;
flex-wrap: wrap;
}
.topbar h1 {
margin: 0;
font-size: clamp(0.9rem, 1.8vmin, 1.3rem);
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
color: var(--gold);
}
.pack-title {
color: var(--muted);
font-size: clamp(0.7rem, 1.3vmin, 0.9rem);
}
.spacer {
flex: 1;
}
.phase-badge {
font-size: 0.68rem;
letter-spacing: 0.1em;
text-transform: uppercase;
color: var(--muted);
border: 1px solid rgba(255, 255, 255, 0.09);
border-radius: 999px;
padding: 0.3em 0.75em;
}
.stage {
flex: 1;
display: flex;
flex-direction: column;
min-height: 0;
}
/* ─── Кнопки ─────────────────────────────────────────────────────────── */
.primary {
background: linear-gradient(180deg, #f1d288, #d8aa47);
color: #241a05;
font-weight: 650;
border-radius: 12px;
padding: 0.7em 1.4em;
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.primary:disabled {
opacity: 0.4;
box-shadow: none;
}
.big {
font-size: clamp(1rem, 1.2vmin + 0.75rem, 1.4rem);
padding: 0.8em 1.9em;
}
.ghost {
border: 1px solid var(--line);
border-radius: 12px;
padding: 0.6em 1.1em;
color: var(--muted);
transition: color 0.12s, border-color 0.12s;
}
.ghost:hover {
color: var(--text);
border-color: var(--gold);
}
.ok {
background: rgba(72, 185, 138, 0.16);
border: 1px solid rgba(72, 185, 138, 0.5);
color: #b9f0d8;
border-radius: 12px;
padding: 0.7em 1.3em;
}
.bad {
background: rgba(226, 103, 95, 0.14);
border: 1px solid rgba(226, 103, 95, 0.45);
color: #ffc9c4;
border-radius: 12px;
padding: 0.7em 1.3em;
}
.icon {
width: 2rem;
height: 2rem;
border-radius: 8px;
color: var(--muted);
line-height: 1;
}
.icon:hover {
color: var(--bad);
background: rgba(226, 103, 95, 0.1);
}
/* ─── Общие раскладки ────────────────────────────────────────────────── */
.center,
.lobby {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: clamp(0.8rem, 2vmin, 1.4rem);
text-align: center;
}
.kicker {
margin: 0;
text-transform: uppercase;
letter-spacing: 0.18em;
font-size: clamp(0.62rem, 1.2vmin, 0.8rem);
color: var(--muted);
}
.title {
margin: 0;
font-size: clamp(1.7rem, 5vmin, 3.2rem);
}
.round-title {
margin: 0;
font-size: clamp(1.5rem, 4.5vmin, 3rem);
color: var(--gold);
}
.note {
margin: 0;
max-width: 48ch;
color: var(--muted);
font-size: 0.84rem;
line-height: 1.55;
}
.status {
margin: 0;
text-align: center;
color: var(--muted);
font-size: clamp(0.8rem, 1.5vmin, 1rem);
}
.status b {
color: var(--text);
}
/* ─── Лобби ──────────────────────────────────────────────────────────── */
.players-editor {
display: flex;
flex-direction: column;
gap: 0.45rem;
width: min(360px, 90vw);
}
.row {
display: flex;
align-items: center;
gap: 0.5rem;
}
.row input {
flex: 1;
}
.player-name {
flex: 1;
text-align: left;
}
/* ─── Табло ──────────────────────────────────────────────────────────── */
.board-stage {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
gap: clamp(0.6rem, 1.5vmin, 1.2rem);
min-height: 0;
}
.board {
display: grid;
gap: clamp(0.4rem, 1.2vmin, 0.9rem);
flex: 1;
min-height: 0;
}
.column {
display: flex;
flex-direction: column;
gap: clamp(0.35rem, 1vmin, 0.75rem);
min-width: 0;
}
.theme {
margin: 0;
padding: 0 clamp(0.2rem, 0.6vmin, 0.4rem) clamp(0.4rem, 1vmin, 0.8rem);
text-align: center;
font-size: clamp(0.7rem, 1.55vmin, 1.35rem);
font-weight: 600;
letter-spacing: 0.05em;
text-transform: uppercase;
color: var(--gold);
border-bottom: 1px solid var(--line);
overflow-wrap: anywhere;
}
.cell {
flex: 1;
min-height: clamp(58px, 9vmin, 120px);
display: grid;
place-items: center;
border-radius: var(--radius);
background: linear-gradient(180deg, rgba(35, 52, 104, 0.85), rgba(18, 26, 56, 0.9));
border: 1px solid rgba(120, 145, 220, 0.18);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s;
}
.cell:hover:not(.closed) {
transform: translateY(-2px);
border-color: var(--gold);
box-shadow: 0 10px 26px rgba(0, 0, 0, 0.38);
}
.cell .value {
font-size: clamp(1rem, 3.2vmin, 2.4rem);
font-weight: 700;
color: var(--gold);
font-variant-numeric: tabular-nums;
}
.cell.closed {
background: rgba(255, 255, 255, 0.025);
border-color: transparent;
box-shadow: none;
}
.cell.closed .snow {
color: rgba(255, 255, 255, 0.14);
font-size: clamp(0.9rem, 2vmin, 1.5rem);
}
/* ─── Вопрос ─────────────────────────────────────────────────────────── */
.question-stage {
flex: 1;
display: flex;
flex-direction: column;
gap: clamp(0.7rem, 2vmin, 1.4rem);
padding: clamp(0.4rem, 2vmin, 1.6rem);
justify-content: center;
}
.q-head {
display: flex;
align-items: center;
gap: 0.75rem;
flex-wrap: wrap;
}
.badge {
font-size: clamp(1.3rem, 3.4vmin, 2.4rem);
font-weight: 800;
color: var(--gold);
font-variant-numeric: tabular-nums;
}
.tag {
font-size: 0.7rem;
letter-spacing: 0.08em;
text-transform: uppercase;
padding: 0.35em 0.7em;
border-radius: 999px;
border: 1px solid var(--line);
color: var(--gold);
}
.question-text {
margin: 0;
font-size: clamp(1.2rem, 3.6vmin, 2.9rem);
line-height: 1.25;
font-weight: 550;
max-width: 60ch;
}
.big-text {
font-size: clamp(1.5rem, 4.6vmin, 3.6rem);
}
.media img,
.media video {
max-width: min(100%, 900px);
max-height: 42vh;
border-radius: var(--radius);
border: 1px solid rgba(255, 255, 255, 0.1);
}
.audio {
display: flex;
align-items: center;
gap: 1rem;
flex-wrap: wrap;
}
.hint {
margin: 0.4rem 0 0;
color: var(--muted);
font-size: 0.85rem;
}
.warn {
margin: 0.4rem 0 0;
color: #ffc9c4;
font-size: 0.8rem;
}
.answer-box {
display: flex;
align-items: center;
gap: 1rem;
flex-wrap: wrap;
}
.answer {
margin: 0;
color: var(--gold);
font-size: clamp(1.3rem, 3.4vmin, 2.6rem);
font-weight: 600;
}
.actions {
display: flex;
flex-direction: column;
gap: 0.7rem;
align-items: flex-start;
}
.label {
margin: 0;
color: var(--muted);
font-size: clamp(0.75rem, 1.4vmin, 0.95rem);
}
.label b {
color: var(--text);
}
.chips {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.chip {
border: 1px solid var(--line);
border-radius: 999px;
padding: 0.55em 1.1em;
font-size: clamp(0.85rem, 1.6vmin, 1.05rem);
transition: border-color 0.12s, background 0.12s;
}
.chip:hover {
border-color: var(--gold);
background: var(--gold-soft);
}
/* ─── Ставки ─────────────────────────────────────────────────────────── */
.bets {
display: flex;
flex-direction: column;
gap: 0.5rem;
width: min(520px, 92vw);
}
.bet-row {
display: flex;
align-items: center;
gap: 0.6rem;
}
.bet-row input {
width: 96px;
flex: none;
}
.bet-done {
color: var(--ok);
font-variant-numeric: tabular-nums;
}
/* ─── Таймер ─────────────────────────────────────────────────────────── */
.countdown {
display: flex;
align-items: baseline;
gap: 0.3rem;
padding: 0.25em 0.85em;
border-radius: 999px;
border: 1px solid var(--line);
color: var(--gold);
font-variant-numeric: tabular-nums;
}
.countdown .count {
font-size: clamp(1.1rem, 2.5vmin, 1.9rem);
font-weight: 700;
}
.countdown .count-label {
font-size: 0.68rem;
color: var(--muted);
}
.countdown.urgent {
border-color: var(--bad);
color: var(--bad);
animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
50% {
opacity: 0.55;
}
}
/* ─── Счёт ───────────────────────────────────────────────────────────── */
.score-list {
list-style: none;
padding: 0;
margin: 0;
width: min(520px, 90vw);
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.score-list li {
display: flex;
justify-content: space-between;
padding: 0.7rem 1rem;
border-radius: 12px;
background: var(--panel);
font-size: clamp(0.95rem, 2vmin, 1.35rem);
}
.score-list li:first-child {
border: 1px solid var(--gold);
background: var(--gold-soft);
}
.scorebar {
display: flex;
flex-wrap: wrap;
gap: 0.6rem;
padding-top: 0.6rem;
border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.score-chip {
display: flex;
align-items: baseline;
gap: 0.6rem;
padding: 0.45rem 0.9rem;
border-radius: 12px;
background: var(--panel);
border: 1px solid transparent;
}
.score-chip.picking {
border-color: var(--gold);
background: var(--gold-soft);
}
.score-chip.answering {
border-color: var(--ok);
background: rgba(72, 185, 138, 0.12);
}
.score-chip.offline {
opacity: 0.45;
}
.score-value {
font-weight: 700;
font-variant-numeric: tabular-nums;
}
/* ─── Финал ──────────────────────────────────────────────────────────── */
.judge-grid {
display: flex;
flex-direction: column;
gap: 0.5rem;
width: min(520px, 92vw);
}
.judge-row {
display: flex;
align-items: center;
gap: 0.5rem;
}
/* ─── Служебное ──────────────────────────────────────────────────────── */
.fatal {
margin: auto;
max-width: 60ch;
padding: 1.5rem;
border: 1px solid var(--bad);
border-radius: var(--radius);
background: rgba(226, 103, 95, 0.08);
}
.toast {
position: fixed;
left: 50%;
bottom: 1.4rem;
transform: translateX(-50%);
padding: 0.7rem 1.2rem;
border-radius: 999px;
background: #1b2340;
border: 1px solid var(--line);
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
font-size: 0.88rem;
max-width: 90vw;
}
/* ─── Служебные элементы экранов ─────────────────────────────────────── */
.room-tag {
font-size: 0.72rem;
letter-spacing: 0.08em;
text-transform: uppercase;
color: var(--muted);
border: 1px solid rgba(255, 255, 255, 0.09);
border-radius: 999px;
padding: 0.3em 0.7em;
}
.link-grid {
display: flex;
gap: 0.8rem;
flex-wrap: wrap;
justify-content: center;
}
/* ─── Лобби на табло: QR и адрес ─────────────────────────────────────── */
.lobby-join {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: clamp(0.6rem, 2vmin, 1.2rem);
text-align: center;
}
.qr {
width: clamp(150px, 24vmin, 300px);
height: auto;
border-radius: 16px;
background: #fff;
padding: 8px;
}
.join-url {
margin: 0;
font-size: clamp(0.78rem, 1.6vmin, 1.05rem);
color: var(--gold);
word-break: break-all;
}
.room-big {
margin: 0;
font-size: clamp(1.5rem, 3.6vmin, 2.6rem);
font-weight: 700;
letter-spacing: 0.12em;
color: var(--text);
}
.chip-list {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
justify-content: center;
max-width: 70ch;
}
/* ─── Табло: клетки не нажимаются ────────────────────────────────────── */
.board.static .cell {
cursor: default;
}
.board.static .cell:hover:not(.closed) {
transform: none;
border-color: rgba(120, 145, 220, 0.18);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
/* ─── Телефон игрока ─────────────────────────────────────────────────── */
.player-shell {
padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
}
.player-stage {
flex: 1;
display: flex;
flex-direction: column;
gap: 0.9rem;
}
.player-head {
display: flex;
align-items: baseline;
gap: 0.5rem;
justify-content: center;
}
.player-score {
font-size: clamp(2rem, 8vmin, 3.2rem);
font-weight: 800;
color: var(--gold);
font-variant-numeric: tabular-nums;
}
.player-block {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 0.9rem;
text-align: center;
}
.player-question {
margin: 0;
text-align: center;
color: var(--muted);
font-size: 0.92rem;
line-height: 1.45;
}
.name-input,
.bet-input {
width: min(280px, 80vw);
text-align: center;
font-size: 1.1rem;
padding: 0.7em 1em;
}
.buzz {
width: min(66vmin, 300px);
aspect-ratio: 1;
border-radius: 50%;
font-size: clamp(1.25rem, 5.5vmin, 1.9rem);
font-weight: 800;
letter-spacing: 0.08em;
color: #241a05;
background: radial-gradient(circle at 35% 30%, #ffe6a3, #e0ab3c 60%, #b98a24);
box-shadow: 0 12px 40px rgba(233, 196, 106, 0.35), inset 0 -6px 14px rgba(0, 0, 0, 0.25);
animation: buzz-pulse 1.6s ease-in-out infinite;
}
.buzz:active {
transform: scale(0.96);
box-shadow: 0 6px 18px rgba(233, 196, 106, 0.3);
}
@keyframes buzz-pulse {
0%,
100% {
transform: scale(1);
}
50% {
transform: scale(1.04);
}
}
/* На телефоне сетка табло должна влезать в ширину экрана. */
.player-shell .board {
width: 100%;
gap: 0.25rem;
}
.player-shell .theme {
font-size: 0.6rem;
padding-bottom: 0.3rem;
}
.player-shell .cell {
min-height: 44px;
border-radius: 10px;
}
.player-shell .cell .value {
font-size: 0.95rem;
}
@media (prefers-reduced-motion: reduce) {
.buzz,
.countdown.urgent {
animation: none;
}
}
/* ─── Обратная связь: вспышки и появление ────────────────────────────── */
.shell {
transition: box-shadow 0.25s ease;
}
.shell.flash-good {
box-shadow: inset 0 0 0 4px rgba(72, 185, 138, 0.55);
}
.shell.flash-bad {
box-shadow: inset 0 0 0 4px rgba(226, 103, 95, 0.55);
}
.score-chip {
transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.score-chip.flash-up {
border-color: var(--ok);
background: rgba(72, 185, 138, 0.18);
transform: translateY(-2px);
}
.score-chip.flash-down {
border-color: var(--bad);
background: rgba(226, 103, 95, 0.16);
transform: translateY(-2px);
}
.question-stage {
animation: stage-in 0.28s ease-out;
}
@keyframes stage-in {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: none;
}
}
.answer {
animation: answer-in 0.35s ease-out;
}
@keyframes answer-in {
from {
opacity: 0;
transform: scale(0.96);
}
to {
opacity: 1;
transform: none;
}
}
.sound-toggle {
font-size: 1rem;
line-height: 1;
padding: 0.45em 0.7em;
}
@media (prefers-reduced-motion: reduce) {
.question-stage,
.answer {
animation: none;
}
.score-chip.flash-up,
.score-chip.flash-down {
transform: none;
}
}