mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-17 04:45:33 -08:00
Add Activities with Snake and Mini golf to play through a wait, paused whenever it is your turn
AI Assisted
This commit is contained in:
1 parent
720758a7ee
commit
dbd31611b7
17 files changed
+8920
-7
No files matched your search
@@ -0,0 +1,245 @@
|
||||
/* 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: Notebook-sized, with the board taking whatever height the
|
||||
title, the banner, the picker, the note and the actions leave. */
|
||||
.modal.activities {
|
||||
width: min(1200px, 90vw);
|
||||
height: min(900px, 85vh);
|
||||
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; }
|
||||
|
||||
/* 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); }
|
||||
|
||||
/* The picker: one button per game, shown only once two are listed. */
|
||||
.activities-picker {
|
||||
flex: none;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.activities-picker[hidden] { display: none; }
|
||||
.activities-picker .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--ink); }
|
||||
|
||||
/* 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;
|
||||
}
|
||||
.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) {
|
||||
.activities-score.tied .activities-chip.best { animation: activities-glow 900ms ease-in-out infinite alternate; }
|
||||
.activities-score.passed .activities-chip,
|
||||
.activities-score.passed .activities-meter { animation: activities-rainbow 2.4s linear infinite; }
|
||||
.activities-score.burst .activities-chip { animation: activities-rainbow 2.4s linear infinite, 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; }
|
||||
Reference in new issue
Block a user