/* Live streak: the week as seven piano keys, shared by the home and completion screens. */
.ms-streak[hidden],.completion-metrics[hidden]{display:none!important}
.ms-streak{--ms-gold:#d48c1c;--ms-ink:#263b52;box-sizing:border-box;display:flex;align-items:center;justify-content:center;gap:16px;width:min(460px,100%);max-width:100%;padding:6px 4px;background:transparent;border:0;border-radius:0;box-shadow:none;color:#5d7086;font:600 12px/1.2 "DM Sans",system-ui,sans-serif}
/* Fluid width keeps the streak inside narrow grid columns (e.g. phone home page). */
.ms-streak-week{display:block;flex:1 1 0;min-width:0;width:100%;max-width:340px;height:auto;overflow:visible}
/* Piano keys: one white key per day; sketched days are coloured in. */
.ms-streak-keys{--k-coral:var(--st-coral,#ff7a6b);--k-sky:var(--st-sky,#4aaef0);--k-sun:var(--st-sun,#ffbe2e);--k-mint:var(--st-mint,#3fcf9c);
  filter:drop-shadow(0 2.5px 0 #dbe6f3)}
.ms-streak-key{fill:#fff;stroke:#cfdcec;stroke-width:1.6}
.ms-streak-day.is-coral{--k:var(--k-coral)}.ms-streak-day.is-sky{--k:var(--k-sky)}
.ms-streak-day.is-sun{--k:var(--k-sun)}.ms-streak-day.is-mint{--k:var(--k-mint)}
.ms-streak-fill{fill:var(--k);stroke:#fff;stroke-width:1.6}
/* Sketched days before a missed day are paler: the live streak is brightest. */
.ms-streak-day.is-done:not(.is-run) .ms-streak-fill{fill-opacity:.42}
.ms-streak-shade{fill:#000;fill-opacity:.12}
.ms-streak-day.is-done:not(.is-run) .ms-streak-shade{fill-opacity:.05}
.ms-streak-hatch{display:none;pointer-events:none}
.ms-streak-black{stroke:none}
.ms-streak-day.is-open .ms-streak-key{fill:#fff8e1;stroke:var(--k-sun)}
.ms-streak-ring{fill:none;stroke:var(--k-sun);stroke-width:2;animation:ms-streak-ring 2.4s ease-in-out infinite}
@keyframes ms-streak-ring{0%,100%{stroke-opacity:.15}50%{stroke-opacity:.9}}
.ms-streak-label{font:400 13px var(--st-hand,"DM Sans"),system-ui,sans-serif;fill:#9fb0c5}
.ms-streak-day.is-done .ms-streak-label{fill:#fff}
.ms-streak-day.is-done.is-sun .ms-streak-label{fill:#6b4a00}
.ms-streak-day.is-done:not(.is-run) .ms-streak-label{fill:#7d8ea3}
.ms-streak-day.is-open .ms-streak-label{fill:var(--ms-ink)}
.ms-streak-today-mark{fill:var(--ms-ink)}
/* Celebrate a fresh submission: today's key is coloured in from the top. */
.ms-streak-day.is-filling :is(.ms-streak-fill,.ms-streak-hatch){transform-box:fill-box;transform-origin:50% 0;animation:ms-streak-key-in .75s .35s cubic-bezier(.34,1.3,.64,1) both}
@keyframes ms-streak-key-in{from{transform:scaleY(0)}to{transform:scaleY(1)}}
/* Count: one flame, lit once today is sketched. */
.ms-streak-count{flex:0 0 auto;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-width:72px;padding-left:16px;border-left:1px solid #e1e7ee;white-space:nowrap;color:#6a7c90;font-size:11px;letter-spacing:.01em}
.ms-streak-figure{display:inline-flex;align-items:center;gap:4px}
.ms-streak-count strong{font-size:32px;line-height:1;letter-spacing:-.045em;color:var(--ms-ink);font-weight:700;font-variant-numeric:tabular-nums}
.ms-streak-flame-icon{width:15px;height:20px;flex:none;overflow:visible;transform-origin:50% 100%}
.ms-streak-flame-outer{fill:#c9d3de;transition:fill .4s}
.ms-streak-flame-inner{fill:#eef2f6;transition:fill .4s}
.ms-streak.is-complete-today .ms-streak-flame-outer{fill:#f08f2a}
.ms-streak.is-complete-today .ms-streak-flame-inner{fill:#ffd86e}
.ms-streak.is-complete-today .ms-streak-flame-icon{filter:drop-shadow(0 0 3px #ffb22e88);animation:ms-flame-flicker 1.4s ease-in-out infinite alternate}
@keyframes ms-flame-flicker{0%{transform:scale(.94,.95) rotate(-3deg)}50%{transform:scale(1.02,1.06) rotate(2deg)}100%{transform:scale(.98,1.1) rotate(-1deg)}}
.ms-streak.is-complete-today .ms-streak-count strong{color:#b8761a}
.ms-streak-count.is-bumping strong{animation:ms-streak-count-in .6s .5s cubic-bezier(.22,1,.36,1) both}
@keyframes ms-streak-count-in{0%{transform:translateY(5px);opacity:.3}65%{transform:translateY(-2px);opacity:1}100%{transform:translateY(0);opacity:1}}
/* No streak yet: the same layout, with the 0 in grey. */
html body .ms-streak.is-empty .ms-streak-count strong{color:#a9b5c3}
.completion-streak{margin:0 auto 12px;width:100%}
@media(max-width:400px){.ms-streak{gap:9px;padding:4px 0}.ms-streak-count{padding-left:9px;min-width:56px;font-size:10px}.ms-streak-count strong{font-size:25px}.ms-streak-flame-icon{width:12px;height:16px}}
@media(max-height:540px){.home-streak{width:min(300px,100%);padding:2px 4px;gap:8px}.home-streak .ms-streak-week{max-width:194px}.home-streak .ms-streak-count{padding-left:8px;min-width:50px}.home-streak .ms-streak-count strong{font-size:21px}.home-streak .ms-streak-flame-icon{width:11px;height:15px}}
@media(prefers-reduced-motion:reduce){.ms-streak-ring,.ms-streak-day.is-filling :is(.ms-streak-fill,.ms-streak-hatch),.ms-streak.is-complete-today .ms-streak-flame-icon,.ms-streak-count.is-bumping strong{animation:none}.ms-streak-ring{stroke-opacity:.7}}
.completion-metrics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;text-align:center;margin:0}
.completion-metric{min-width:0;border:1px solid #dbe3ec;background:#f7f9fc;border-radius:10px;padding:12px 7px;display:grid;gap:5px;align-content:center}
.completion-metric dt{font:600 11px/1.3 "DM Sans",system-ui,sans-serif;color:#68788c}
.completion-metric dd{margin:0;font:750 19px/1.2 "DM Sans",system-ui,sans-serif;color:#213951;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.completion-metric dd[data-unavailable="true"]{font-size:12px;font-weight:600}
@media(max-height:540px){.completion-metric{padding:7px 5px}}
@media(max-width:360px){.completion-metric dd{font-size:15px}}


/* Quiet elapsed-time display in the metadata row, above requirements. */
.sketch-elapsed-timer[hidden]{display:none!important}
.paper>.sketch-elapsed-timer{grid-column:1;grid-row:1;justify-self:start;align-self:end;z-index:2;display:inline-flex;align-items:center;gap:5px;padding:3px 1px;color:#66788c;font:500 14px/1.25 "DM Sans",system-ui,sans-serif;font-variant-numeric:tabular-nums;white-space:nowrap;pointer-events:none}
.sketch-elapsed-timer svg{width:16px;height:16px;flex:none}
#sketchElapsedValue{min-width:5ch;text-align:left}
@media(max-width:600px) and (orientation:portrait){
  .paper>.sketch-elapsed-timer{align-self:start;font-size:13px}
  html.public-sketch-ui .paper:has(>.sketch-elapsed-timer:not([hidden]))>.paper-heading{margin-top:23px!important}
  html.public-sketch-ui .paper:has(>.sketch-elapsed-timer:not([hidden]))>.challenge-constraints{top:148px!important;max-height:min(43dvh,calc(100% - 161px))!important}
}
@media(max-width:1024px) and (max-height:500px) and (orientation:landscape){
  .paper>.sketch-elapsed-timer{align-self:center;font-size:12px}
  .sketch-elapsed-timer svg{width:14px;height:14px}
  html.public-sketch-ui body:not(.creator-mode):not(.tutorial-mode):not(.solution-mode):not(.no-challenge-mode) .paper:has(>.sketch-elapsed-timer:not([hidden]))>.paper-heading{padding-left:88px!important}
}

/* Keep the manuscript wallpaper behind a fully opaque score surface.
   The paper covers the decoration, including beneath timer and requirements. */
html.public-sketch-ui body:not(.creator-mode):not(.tutorial-mode):not(.solution-mode) .workspace{
  background:transparent;
}
html.public-sketch-ui body:not(.creator-mode):not(.tutorial-mode):not(.solution-mode) .workspace > .paper{
  background:#fff;
  border-radius:22px;
  box-shadow:0 0 23px 3px rgba(var(--ambient-voice-rgb),.21),0 0 84px 26px rgba(var(--ambient-voice-rgb),.10);
  animation:ms-paper-voice-glow 10s ease-in-out infinite alternate;
}
/* Only the outside shadow pulses. The white paper remains fully opaque. */
@keyframes ms-paper-voice-glow{
  from{box-shadow:0 0 23px 3px rgba(var(--ambient-voice-rgb),.14),0 0 84px 26px rgba(var(--ambient-voice-rgb),.065)}
  to{box-shadow:0 0 23px 3px rgba(var(--ambient-voice-rgb),.21),0 0 84px 26px rgba(var(--ambient-voice-rgb),.10)}
}
@media(prefers-reduced-motion:reduce){
  html.public-sketch-ui body:not(.creator-mode):not(.tutorial-mode):not(.solution-mode) .workspace > .paper{animation:none}
}
html.public-sketch-ui body:not(.creator-mode):not(.tutorial-mode):not(.solution-mode) .workspace::before,
html.public-sketch-ui body:not(.creator-mode):not(.tutorial-mode):not(.solution-mode) .workspace::after{
  content:none!important;
}
@media(max-width:700px){
  html.public-sketch-ui body:not(.creator-mode):not(.tutorial-mode):not(.solution-mode) .workspace > .paper{border-radius:12px}
}
