Files
plan2code/src/web-console/public/styles/activities.css
T
2026-11-02 13:22:59 -08:00

462 lines
19 KiB
CSS

/* Activities: the top bar's die, the dialog, the board, its overlay, the
your-turn banner and the notes. The game draws its own board on the canvas. */
/* The top bar's die, drawn and lit like the megaphone and the gear beside it. */
.icon-btn .dc-body { fill: none; stroke: var(--ink-3); stroke-width: 1.4; }
.icon-btn .dc-pip { fill: var(--ink-2); stroke: none; }
.icon-btn:hover .dc-body { stroke: var(--accent); }
.icon-btn:hover .dc-pip { fill: var(--accent); }
/* Show Activities off in User Preferences: .icon-btn's grid would beat the
attribute's own display. */
#btn-activities[hidden] { display: none; }
/* The dialog: as large as the viewport allows, a slim edge all round so it
still reads as a window, with the board taking whatever height the title,
the banner, the picker, the note and the actions leave. */
.modal.activities {
width: calc(100vw - 32px);
height: calc(100vh - 32px);
max-width: none;
max-height: none;
flex-direction: column;
}
.modal.activities[open] { display: flex; }
.modal.activities h2,
.modal.activities .modal-blurb,
.modal.activities .modal-actions { flex: none; }
.modal.activities .modal-blurb { margin-bottom: 12px; }
#activities-full[hidden] { display: none; }
/* The stage: no box of its own in the window, so the board and the score
line lay out as they always have. */
.activities-stage { display: contents; }
/* Full screen: the stage takes the whole screen (the browser's own full
screen, or the page where it refuses one) and the board takes all of the
stage, black bars where the game's shape leaves room, so the canvas is as
big as the screen allows. Nothing sits beside the board: the panel (the
game's name, the score line, Music and a way out) is laid over it.
screens/activities.js docks the panel in a black bar when one is wide or
tall enough to hold it (`data-dock="side"` or `"below"`, with the bar's
size in --bar), and floats it in the top right corner otherwise. */
.activities-stage.full {
position: fixed;
inset: 0;
z-index: 10;
display: block;
width: 100vw;
height: 100vh;
background: #000;
color: #f2f2f2;
}
.activities-stage.full .activities-board {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
border: none;
background: #000;
}
/* The pointer hides after a still moment and comes back on any move. */
.activities-stage.full.idle,
.activities-stage.full.idle * { cursor: none !important; }
/* The panel: a dark glass card in the same colors in either theme, since it
sits on black bars or on the game itself, never on the page. */
.activities-rail {
position: absolute;
z-index: 2;
box-sizing: border-box;
display: flex;
flex-direction: column;
gap: 12px;
max-width: 340px;
padding: 16px 18px;
border: 1px solid rgb(255 255 255 / 0.14);
border-radius: 12px;
background: rgb(14 14 18 / 0.74);
backdrop-filter: blur(8px);
box-shadow: 0 8px 28px rgb(0 0 0 / 0.45);
color: #f2f2f2;
overflow: hidden;
transition: opacity 0.25s ease, padding 0.25s ease;
}
.activities-rail[hidden] { display: none; }
.activities-stage[data-dock="float"] .activities-rail { top: 16px; right: 16px; }
/* Docked: centered in its bar, so it never covers the play. */
.activities-stage[data-dock="side"] .activities-rail {
top: 50%;
right: calc(var(--bar) / 2);
transform: translate(50%, -50%);
max-height: calc(100% - 32px);
}
.activities-stage[data-dock="below"] .activities-rail {
left: 50%;
bottom: calc(var(--bar) / 2);
transform: translate(-50%, 50%);
max-width: calc(100% - 32px);
max-height: calc(var(--bar) - 16px);
flex-direction: row;
flex-wrap: wrap;
align-items: center;
justify-content: center;
gap: 8px 20px;
padding: 10px 18px;
}
/* Floating over a round in play, once the pointer is still: only the score
line stays, small and see-through, in the bottom corner (games keep their
own top bar of pills at the top), so the game shows through it. Any move
of the pointer, a pause or a round's end brings the whole panel back. */
.activities-stage[data-dock="float"].live.idle .activities-rail {
top: auto;
bottom: 16px;
padding: 6px 12px;
opacity: 0.72;
pointer-events: none;
}
.activities-stage[data-dock="float"].live.idle .activities-rail > :not(.activities-rail-score) { display: none; }
.activities-rail p { margin: 0; }
.activities-rail-title { font: 800 clamp(18px, 1.6vw, 30px) / 1.15 var(--serif); }
.activities-rail-best { color: #c8c8c8; font-weight: 600; font-variant-numeric: tabular-nums; }
/* Once a round has a score line, its best chip says it instead. */
.activities-rail:has(.activities-score:not(:empty)) .activities-rail-best { display: none; }
.activities-rail-keys { color: #a8a8a8; font-size: 0.9em; line-height: 1.6; }
.activities-rail kbd { background: rgb(255 255 255 / 0.08); border-color: rgb(255 255 255 / 0.22); color: #f2f2f2; }
.activities-rail .btn { background: rgb(255 255 255 / 0.08); border-color: rgb(255 255 255 / 0.25); color: #f2f2f2; }
.activities-rail .btn:hover { background: rgb(255 255 255 / 0.16); }
.activities-rail .btn,
.activities-rail .activities-music { align-self: flex-start; color: #f2f2f2; }
.activities-stage[data-dock="below"] .activities-rail .btn,
.activities-stage[data-dock="below"] .activities-rail .activities-music { align-self: center; }
/* The score line in the panel: one chip a row, the score big, the meter as
wide as the panel. */
.activities-rail .activities-score {
height: auto;
margin: 0;
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 10px;
line-height: normal;
white-space: normal;
color: #f2f2f2;
}
.activities-rail .activities-score:empty { display: none; }
.activities-rail .activities-chip.score { font-size: clamp(16px, 1.4vw, 26px); line-height: 1.6; }
.activities-rail .activities-chip.best { margin-left: 0; }
.activities-rail .activities-meter { width: 100%; min-width: 140px; margin: 0; }
.activities-stage[data-dock="below"] .activities-rail .activities-score { flex-direction: row; align-items: center; }
.activities-stage[data-dock="below"] .activities-rail .activities-meter { width: 160px; }
.activities-rail .activities-music span { color: #c8c8c8; }
/* The still, floating score: the chips stacked and right-aligned, narrow
enough to sit mostly in a thin black bar, the meter left out. */
.activities-stage[data-dock="float"].live.idle .activities-rail .activities-score { align-items: flex-end; gap: 6px; }
.activities-stage[data-dock="float"].live.idle .activities-rail .activities-chip.score { font-size: 15px; }
.activities-stage[data-dock="float"].live.idle .activities-rail .activities-meter { display: none; }
/* Plan2Code needs the person: an attention strip in the highlight color,
above the board, that never covers it. */
.activities-banner {
flex: none;
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 12px;
padding: 8px 12px;
border: 1px solid var(--accent);
border-radius: 8px;
background: var(--accent-soft);
color: var(--ink);
}
.activities-banner[hidden] { display: none; }
.activities-banner-text { flex: 1 1 auto; font-weight: 600; }
.activities-banner .btn.primary { flex: none; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
/* Shown only while a turn or finish holds the round: the one way to play on. */
.activities-banner .btn { flex: none; }
.activities-banner .btn[hidden] { display: none; }
/* The picker: a page of game cards in place of the board, shown once two or
more games are listed. Each card is one button: a cover scene, the title,
a line about the game, its best, and a tag for the last one played. */
.activities-picker {
flex: 1 1 auto;
min-height: 0;
overflow: auto;
padding: 4px 2px 8px;
}
.activities-picker[hidden] { display: none; }
/* Cards keep one width and wrap, and each row (a short last one too) sits in
the middle, so a wide window is filled evenly and no corner is left bare. */
.activities-cards {
--card-w: 250px;
--gap: 16px;
/* At most six across: the width of six cards and the gaps between them. */
max-width: calc(6 * var(--card-w) + 5 * var(--gap));
margin-inline: auto;
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: var(--gap);
}
.activities-cards > .activities-card { flex: 0 0 var(--card-w); max-width: 100%; }
.activities-card {
position: relative;
display: flex;
flex-direction: column;
padding: 0;
overflow: hidden;
border: 1px solid var(--rule-2);
border-radius: 12px;
background: var(--panel);
color: var(--ink);
font: inherit;
text-align: left;
cursor: pointer;
transition: border-color 120ms ease-out, box-shadow 120ms ease-out, transform 120ms ease-out;
}
.activities-card:hover,
.activities-card:focus-visible {
border-color: var(--accent-line);
box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow);
outline: none;
}
.activities-cover { display: block; border-bottom: 1px solid var(--rule-2); background: var(--panel-2); }
.activities-cover svg { display: block; width: 100%; height: auto; aspect-ratio: 5 / 3; }
/* A course dashboard: three across where it fits, so all six courses show
at once. A course card's art is a hole drawn on a 4:3 canvas, cropped to a
wide strip through its middle, where the play is. */
.activities-courses { --card-w: 290px; }
.activities-cover canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
/* The covers' token colors (screens/activities.js names them), so a cover
follows the theme and the highlight like the boards do. */
.activities-cover .cv-panel { fill: var(--panel); }
.activities-cover .cv-rule { fill: var(--rule); opacity: 0.45; }
.activities-cover .cv-ink { fill: var(--ink); }
.activities-cover .cv-ink2 { fill: var(--ink-2); }
.activities-cover .cv-accent { fill: var(--accent); }
.activities-cover .cv-accent-line { stroke: var(--accent); }
.activities-cover .cv-ink3-line { stroke: var(--ink-3); }
.activities-card-body { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; }
.activities-card-title { font-size: 1.12em; font-weight: 800; }
.activities-card-blurb { color: var(--ink-2); line-height: 1.35; }
.activities-card-meta { color: var(--ink-3); font-size: 0.9em; font-weight: 600; font-variant-numeric: tabular-nums; }
.activities-card-best { margin-top: 4px; color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.activities-card-tag {
position: absolute;
top: 10px;
right: 10px;
padding: 2px 10px;
border-radius: 999px;
background: color-mix(in srgb, var(--panel) 88%, transparent);
border: 1px solid var(--rule-2);
color: var(--ink-2);
font-size: 0.82em;
font-weight: 700;
}
.activities-card-tag.waiting { border-color: var(--accent-line); background: var(--accent-soft); color: var(--ink); }
.activities-picker-note { margin: 12px 0 0; }
/* All games sits at the far left of the actions, away from Close. */
.modal.activities .activities-back { margin-right: auto; }
.modal.activities .activities-back[hidden] { display: none; }
/* The game's own music volume, beside Full screen (only for a game with music). */
.modal.activities .activities-music { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 0.9em; }
.modal.activities .activities-music[hidden] { display: none; }
.modal.activities .activities-music input { width: 110px; accent-color: var(--accent); }
.modal.activities .activities-music:has(input:disabled) { opacity: 0.55; }
@media (prefers-reduced-motion: no-preference) {
.activities-card:hover { transform: translateY(-2px); }
}
/* The board: fills the free space and centers the canvas, with the state
text laid over its middle. */
.activities-board {
position: relative;
flex: 1 1 auto;
min-height: 0;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
border: 1px solid var(--rule-2);
background: var(--panel-2);
}
.activities-board:focus { outline: none; }
.activities-board:focus-visible { border-color: var(--accent-line); }
.activities-board[hidden] { display: none; }
.activities-board canvas { display: block; }
/* Mini golf's page colors (activities/golf-draw.js reads them off the
canvas) for its ball, aim, pills and scorecard, all mixed from the page's
tokens so they look right in light and dark and follow a picked highlight.
The course itself (a pirate sea, a dark cave) keeps its own fixed colors.
The canvas takes color-mix() as it is. */
.activities-board canvas {
--golf-shadow: color-mix(in srgb, black 24%, transparent);
--golf-pole: color-mix(in srgb, white 90%, var(--stage));
--golf-ball: color-mix(in srgb, white 96%, var(--stage));
--golf-aim: var(--golf-ball);
--golf-power: var(--accent);
--golf-card: var(--panel);
--golf-ink: var(--ink);
--golf-ink2: var(--ink-2);
--golf-under: var(--ok);
--golf-over: var(--warn);
--golf-burst: var(--stage);
}
.activities-overlay {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
max-width: 80%;
padding: 10px 16px;
border-radius: 8px;
background: var(--panel);
color: var(--ink);
box-shadow: var(--shadow);
font-weight: 600;
text-align: center;
white-space: pre-line;
cursor: pointer;
}
/* The 3, 2, 1 before play: a big number, not a note, and nothing to click. */
.activities-overlay.count {
min-width: 2.4em;
font-size: 48px;
line-height: 1;
font-variant-numeric: tabular-nums;
cursor: default;
}
.activities-overlay:empty,
.activities-overlay[hidden] { display: none; }
/* The header's best for the game on screen: quieter than the title. */
.activities-title-best { font-weight: 400; color: var(--ink-2); font-variant-numeric: tabular-nums; }
/* The round's score beside the best, under the board, as colored chips with
a meter between them (screens/activities.js builds them). Its height is
fixed, empty or not, so the board does not jump the moment a round starts. */
.activities-score {
--score-gold: color-mix(in srgb, var(--stage) 80%, #f5b301);
flex: none;
height: 30px;
margin: 8px 0 0;
display: block;
line-height: 30px;
color: var(--ink-2);
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
/* Hidden on the picker, where there is no round. */
.activities-score[hidden] { display: none; }
.activities-chip {
display: inline-block;
padding: 0 12px;
line-height: 26px;
border-radius: 999px;
border: 1px solid;
font-weight: 600;
vertical-align: middle;
}
.activities-chip b { font-weight: 800; font-size: 1.08em; }
.activities-chip.score {
border-color: var(--accent-line);
background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--accent) 22%, var(--panel)));
color: var(--ink);
}
.activities-chip.score b { color: var(--accent); }
.activities-chip.best {
border-color: color-mix(in srgb, var(--score-gold) 55%, transparent);
background: linear-gradient(135deg, color-mix(in srgb, var(--score-gold) 14%, var(--panel)), color-mix(in srgb, var(--score-gold) 28%, var(--panel)));
color: var(--ink);
}
.activities-chip.best b { color: var(--score-gold); }
/* The " · " between them stays in the text (a plain inline span, so its
spaces count) but takes no room; the best chip keeps its own gap. */
.activities-sep { font-size: 0; }
.activities-chip.best { margin-left: 8px; }
/* The meter: how far the score has come toward the best. */
.activities-meter {
display: inline-block;
width: 120px;
height: 8px;
margin: 0 2px 0 10px;
border-radius: 999px;
background: linear-gradient(90deg, var(--accent), var(--score-gold)) no-repeat var(--rule-2);
background-size: calc(var(--fill, 0) * 100%) 100%;
vertical-align: middle;
transition: background-size 200ms ease-out;
}
/* Reaching the best: the best chip glows. */
.activities-score.tied .activities-chip.best {
border-color: var(--score-gold);
box-shadow: 0 0 0 3px color-mix(in srgb, var(--score-gold) 30%, transparent);
}
/* Past it: a rainbow line and a NEW BEST tag (drawn by CSS, so the line still
reads as its plain text). */
.activities-score.passed .activities-chip,
.activities-score.passed .activities-meter {
background: linear-gradient(90deg, #ff4fa3, #f5b301, #57b54a, #1fb6d9, #a466ff, #ff4fa3);
background-size: 300% 100%;
border-color: transparent;
color: #ffffff;
}
.activities-score.passed .activities-chip b { color: #ffffff; }
.activities-score.passed .activities-chip { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45); }
.activities-score.passed .activities-chip.score::after {
content: "NEW BEST";
margin-left: 8px;
padding: 1px 6px;
border-radius: 999px;
background: rgba(0, 0, 0, 0.28);
font-size: 0.72em;
font-weight: 800;
letter-spacing: 0.06em;
}
/* The sparks fanning up out of the chips as the best is passed. */
.activities-spark {
position: absolute;
width: 8px;
height: 8px;
margin: -4px 0 0 -4px;
border-radius: 2px;
background: var(--c);
pointer-events: none;
opacity: 0;
z-index: 2;
}
/* The end of a round that set a new best: the overlay says so in rainbow. */
.activities-overlay.record { border: 2px solid transparent; background: linear-gradient(var(--panel), var(--panel)) padding-box, linear-gradient(90deg, #ff4fa3, #f5b301, #57b54a, #1fb6d9, #a466ff) border-box; }
.activities-overlay.record::before {
content: "New best!";
display: block;
margin-bottom: 4px;
font-size: 22px;
font-weight: 800;
background: linear-gradient(90deg, #ff4fa3, #f5b301, #1fb6d9, #a466ff);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
@media (prefers-reduced-motion: no-preference) {
/* Each plays once, as the best is reached or passed, then the line holds
still for the rest of the round. */
.activities-score.tied .activities-chip.best { animation: activities-glow 900ms ease-in-out 2 alternate; }
.activities-score.burst .activities-meter { animation: activities-rainbow 1.2s ease-out; }
.activities-score.burst .activities-chip { animation: activities-rainbow 1.2s ease-out, activities-pop 600ms cubic-bezier(0.3, 1.6, 0.5, 1); }
.activities-spark { animation: activities-spark 1s cubic-bezier(0.2, 0.7, 0.4, 1) forwards; }
.activities-overlay.record::before { animation: activities-pop 600ms cubic-bezier(0.3, 1.6, 0.5, 1); }
}
@keyframes activities-glow { to { box-shadow: 0 0 0 6px color-mix(in srgb, var(--score-gold) 12%, transparent), 0 0 16px color-mix(in srgb, var(--score-gold) 60%, transparent); } }
@keyframes activities-rainbow { to { background-position: 300% 0; } }
@keyframes activities-pop { 0% { transform: scale(0.8); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes activities-spark {
0% { opacity: 1; transform: translate(0, 0) rotate(0); }
70% { opacity: 1; }
100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 30px)) rotate(var(--spin)); }
}
/* The keyboard, bigger-window and load-failure notes: shown in place of play. */
.activities-note { flex: none; margin: 12px 0 0; color: var(--ink-2); }
.activities-note[hidden] { display: none; }