Say "Out of time", and stop the sheets shadowing the clock
Two things Hans spotted playing on the phone. A blackish gradient sat across the bottom of the screen. Both sheets are fixed to bottom:0 and pushed off with translateY(101%), but their box-shadow is thrown 18px *upward* with a 50px blur — so a closed sheet, sitting 1% below the viewport, blurred darkness back onto the clock and left it there, twice over, once per sheet. The shadow now only exists on .sheet.on. Down one column the bottom used to fade 154 to 111 over the last 70px; it is flat 154 to the edge. An open sheet still casts exactly what it did. A flagged clock now reads "Out of time" over two lines in white instead of showing 0:00, on the red the panel already turned. Sizing it off the viewport would not work: the score lines above eat into what is left, so a 5-point match has less room than a 1-point one on the same phone. The stack is a size container and the words take the smaller of 23vw and 42cqh — two lines at line-height 1.04 need 2.08x the font size, so 42% of the container leaves a tenth spare. Measured in real viewports it lands between 52px on a 320x568 at five points and 95px on a 412x915, fitting every combination; with two lines it is the width that binds first, "Out of" being the long line. The other half keeps showing its own time. Checked that normal play still shows clocks and hides the words on both panels, and that Reset puts the flagged panel back to its clock. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+34
-1
@@ -122,6 +122,22 @@
|
||||
letter-spacing:-.02em;
|
||||
}
|
||||
|
||||
/* the flagged player's clock is replaced by the words, on two lines.
|
||||
Sized off the space that's actually left rather than the viewport, because
|
||||
the score lines above eat into it: two lines at line-height 1.04 need 2.08x
|
||||
the font size, so 42cqh of the stack's content box leaves a tenth of it as
|
||||
breathing room. On two lines the width binds first — "Out of" is the long
|
||||
line — which is what the vw term is holding. */
|
||||
.stack{container-type:size}
|
||||
.out{
|
||||
font-size:clamp(24px,min(23vw,42cqh),130px);
|
||||
line-height:1.04;
|
||||
font-weight:700;
|
||||
letter-spacing:-.01em;
|
||||
text-align:center;
|
||||
color:#fff;
|
||||
}
|
||||
|
||||
/* ---------- the delay readout (the bit chess.com doesn't have) ---------- */
|
||||
.delay{
|
||||
display:flex;align-items:center;
|
||||
@@ -224,9 +240,14 @@
|
||||
transition:transform .26s cubic-bezier(.32,.72,0,1);
|
||||
max-height:92vh;max-height:92dvh;overflow-y:auto; /* the scroll is a safety net for the smallest screens, not the normal case */
|
||||
overscroll-behavior:contain; /* scrolling the sheet can't rubber-band the app */
|
||||
}
|
||||
/* only while it's up: the shadow is thrown 18px upward with a 50px blur, and a
|
||||
closed sheet sits just 1% below the viewport, so on .sheet it bled back onto
|
||||
the bottom of the clock and sat there — twice over, once per sheet */
|
||||
.sheet.on{
|
||||
transform:translateY(0);
|
||||
box-shadow:0 -18px 50px rgba(0,0,0,.45);
|
||||
}
|
||||
.sheet.on{transform:translateY(0)}
|
||||
|
||||
.grab{width:38px;height:4px;border-radius:99px;background:#4A4644;margin:5px auto 11px}
|
||||
|
||||
@@ -341,6 +362,7 @@
|
||||
</div>
|
||||
<div class="stack">
|
||||
<div class="time" data-time>3:00</div>
|
||||
<div class="out" data-out hidden>Out of<br>time</div>
|
||||
<div class="delay" data-delay>
|
||||
<span class="track"><i class="fill" data-fill></i></span>
|
||||
<span class="dnum" data-dnum>15</span>
|
||||
@@ -402,6 +424,7 @@
|
||||
</div>
|
||||
<div class="stack">
|
||||
<div class="time" data-time>3:00</div>
|
||||
<div class="out" data-out hidden>Out of<br>time</div>
|
||||
<div class="delay" data-delay>
|
||||
<span class="track"><i class="fill" data-fill></i></span>
|
||||
<span class="dnum" data-dnum>15</span>
|
||||
@@ -600,6 +623,7 @@
|
||||
return {
|
||||
root: p,
|
||||
time: p.querySelector("[data-time]"),
|
||||
out: p.querySelector("[data-out]"),
|
||||
moves: p.querySelector("[data-moves]"),
|
||||
you: p.querySelector("[data-you]"),
|
||||
them: p.querySelector("[data-them]"),
|
||||
@@ -729,6 +753,9 @@
|
||||
function setAttr(node, name, value){
|
||||
if(node.getAttribute(name) !== value) node.setAttribute(name, value);
|
||||
}
|
||||
function setHidden(node, on){
|
||||
if(node.__h !== on){ node.__h = on; node.hidden = on; }
|
||||
}
|
||||
function setStyle(node, prop, value){
|
||||
var k = "__s_" + prop; // per property, so a second one can't alias
|
||||
if(node[k] !== value){ node[k] = value; node.style[prop] = value; }
|
||||
@@ -752,6 +779,12 @@
|
||||
|
||||
if(live && main <= 0 && st.phase === RUN){ flag(i); return; }
|
||||
|
||||
// the flagged player's clock is replaced by the words; the other panel
|
||||
// keeps showing its own remaining time
|
||||
var out = (st.phase === FLAG && i === st.active);
|
||||
setHidden(el[i].time, out);
|
||||
setHidden(el[i].out, !out);
|
||||
|
||||
setText(el[i].time, fmt(main));
|
||||
setText(el[i].moves, st.moves[i]);
|
||||
setText(el[i].you, st.score[i]); // each panel is "You" to its own player
|
||||
|
||||
Reference in New Issue
Block a user