/* Musical Sketch: progress and achievements layer.
   Loaded last on every public page. It adds the streak card, achievement
   seals, rewards and celebrations in the site's own language: cool paper
   whites, blue-grey rules, navy ink and one aged-gold accent for things
   earned. The site's own buttons, calendar and info pages are left as
   they are. Every animation stops under prefers-reduced-motion. */
/* Seals and bursts use SMuFL glyphs; pages without the editor need the font too. */
@font-face{font-family:Bravura;src:url('https://cdn.jsdelivr.net/npm/@vexflow-fonts/bravura/bravura.woff2') format('woff2');font-display:swap}
:root{
  --ms-paper:#fbfcfd;--ms-wash:#f5f8fb;--ms-rule:#e1e8f0;--ms-rule-strong:#d3dce6;
  --ms-ink:#202b3a;--ms-ink-soft:#5d6f85;--ms-ink-faint:#8a99ab;--ms-score:#31577e;
  --ms-gold:#c59a3e;--ms-gold-soft:#f8f1e1;
  --ms-bronze:#b98258;--ms-silver:#a7b2c0;--ms-goldmetal:#c9a04b;--ms-platinum:#8dbbcd;
  --ms-ease:cubic-bezier(.22,1,.36,1);
}

/* ---------- Buttons: the site's own styles, with a gentle press -------- */
html body.home-page .challenge-link,
html.public-sketch-ui body:not(.creator-mode) .submit-main,
html body .account-primary,
html body.info-page .info-panel .info-primary{transition:transform .14s var(--ms-ease),box-shadow .2s ease,background-color .2s ease}
html body.home-page .challenge-link:active,
html.public-sketch-ui body:not(.creator-mode) .submit-main:active:not(:disabled),
html body .account-primary:active,
html body.info-page .info-panel .info-primary:active{transform:translateY(1px)}

/* ---------- Home: one progress card under the main button ------------- */
.ms-home-progress[hidden],.ms-quest[hidden],.ms-rewards[hidden],.ms-profile-rank[hidden]{display:none!important}
@keyframes ms-play-rise{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.ms-home-progress{
  box-sizing:border-box;display:flex;align-items:center;justify-content:center;
  max-width:calc(100vw - 32px);margin-top:4px;padding:10px 18px 10px 14px;
  border-radius:18px;border:1px solid var(--ms-rule);background:rgba(255,255,255,.9);
  box-shadow:0 14px 36px rgba(36,51,74,.07),0 2px 8px rgba(36,51,74,.03);
  backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);
  animation:ms-play-rise .5s .1s var(--ms-ease) both;
}
.ms-home-progress .ms-streak{width:auto;flex:0 1 auto;padding:0;gap:14px}
.ms-home-progress .ms-streak-week{flex:0 1 270px;width:270px;max-width:270px}
.ms-home-progress .ms-streak-count{min-width:64px;padding-left:14px}
.ms-home-progress .ms-streak-count strong{font-size:30px}
.ms-quest{display:grid;gap:10px;width:250px;max-width:100%;text-align:left}
.ms-home-progress>.home-streak:not([hidden])+.ms-quest{
  margin-left:18px;padding-left:20px;border-left:1px solid var(--ms-rule);
}
.ms-quest-goal{display:flex;align-items:center;gap:11px;margin:-6px -8px;padding:6px 8px;border-radius:12px;color:inherit;text-decoration:none;transition:background-color .2s}
.ms-quest-goal:hover{background:var(--ms-wash)}
.ms-quest-goal:focus-visible{outline:2px solid var(--ms-score);outline-offset:2px}
.ms-quest-goal:hover .ms-quest-chevron{transform:translateX(2px);color:var(--ms-ink)}
.ms-quest-chevron{flex:none;margin-left:2px;font:400 20px/1 "DM Sans",sans-serif;color:#a9b5c3;transition:transform .2s,color .2s}
.ms-quest-goal-body{flex:1;min-width:0}
.ms-quest-label{margin:0 0 6px;white-space:nowrap;font:500 12px/1.3 "DM Sans",system-ui,sans-serif;color:var(--ms-ink-soft)}
.ms-quest-label strong{color:var(--ms-ink);font-weight:700}
.ms-quest-label.is-invite{margin:0;font-size:12.5px}
.ms-quest:not(:has(.ms-quest-week)){width:auto}
.ms-quest-goal .ms-bar{width:100%}
.ms-quest-week{display:flex;align-items:center;gap:9px;padding-left:2px;font:500 11.5px/1.2 "DM Sans",system-ui,sans-serif;color:var(--ms-ink-soft)}
.ms-quest-week.is-met{color:#8a6420}
/* Phones: the card stacks, with the achievement row under the streak. */
@media(max-width:600px){
  .ms-home-progress{flex-direction:column;align-items:stretch;width:min(360px,calc(100vw - 28px));padding:8px 14px 12px}
  .ms-home-progress .ms-streak{width:100%;justify-content:center}
  .ms-home-progress .ms-streak-week{flex:1 1 0;width:100%;max-width:260px}
  .ms-quest{grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px;width:auto}
  .ms-quest-label{white-space:normal}
  .ms-home-progress>.home-streak:not([hidden])+.ms-quest{
    margin:8px 0 0;padding:10px 0 0;border-left:0;border-top:1px solid var(--ms-rule);
  }
  .ms-quest-week{flex-direction:column;align-items:flex-end;gap:5px;padding:0;text-align:right}
}
/* Short phones (e.g. 360x640, iPhone SE): one slim line, no week dots. */
@media(max-width:600px) and (max-height:700px){
  .ms-home-progress{padding:5px 12px 8px;margin-top:0}
  .ms-home-progress .ms-streak-week{max-width:230px}
  .ms-home-progress .ms-streak-count strong{font-size:24px}
  .ms-quest{grid-template-columns:1fr}
  .ms-home-progress>.home-streak:not([hidden])+.ms-quest{margin-top:4px;padding-top:7px}
  .ms-quest-week{display:none}
  .ms-quest-goal{gap:8px;margin:-3px -6px;padding:3px 6px}
  .ms-quest-goal .msx-emblem{width:24px;height:24px}
  .ms-quest-label{margin-bottom:4px;font-size:11px;white-space:nowrap}
  html body.home-page .challenge-link{min-height:50px;padding-top:11px;padding-bottom:11px}
}
/* Short phones: lift the title half as far (so it never rises into the
   Log in / My Sketches buttons) and use the free space below the buttons
   instead; the staff between them keeps its room. */
@media(max-width:600px) and (max-height:700px){
  html body.home-page .centerpiece.is-spread .brand{
    transform:translate3d(0,calc(-.5 * var(--hero-spread) - var(--title-nudge,0px)),0)
  }
  html body.home-page .centerpiece.is-spread .home-actions{
    transform:translate3d(0,calc(1.6 * var(--hero-spread) + var(--button-nudge,0px)),0)
  }
}
/* Short laptop screens: a slimmer card and button keep the staff roomy. */
@media(min-width:601px) and (max-height:780px){
  .ms-home-progress{padding:6px 16px 6px 10px;border-radius:16px}
  .ms-home-progress .ms-streak-week{flex-basis:230px;width:230px;max-width:230px}
  .ms-home-progress .ms-streak-count strong{font-size:25px}
  .ms-quest{gap:7px}
  html body.home-page .challenge-link{min-height:54px;padding-top:13px;padding-bottom:13px}
}

/* ---------- Progress bars and week dots ------------------------------- */
.ms-chip-body{display:flex;flex-direction:column;align-items:flex-start;gap:4px;min-width:0}
.ms-chip-label{white-space:nowrap}
.ms-bar{display:block;width:120px;max-width:100%;height:5px;border-radius:99px;background:#e7edf3;overflow:hidden}
.ms-bar-fill{
  display:block;height:100%;width:var(--ms-fill,0%);border-radius:inherit;background:var(--ms-score);
  animation:ms-play-fill .9s .2s var(--ms-ease) both;
}
@keyframes ms-play-fill{from{width:0}}
.ms-week-pips{display:inline-flex;gap:3px}
.ms-pip{width:7px;height:7px;border-radius:50%;background:#e4eaf1}
.ms-pip.is-done{background:var(--ms-gold)}
.ms-pip.is-today:not(.is-done){box-shadow:inset 0 0 0 1.5px var(--ms-ink-soft);background:#fff}
.ms-pip.is-future{opacity:.6}

/* ---------- Achievement seals (ms-achievements.js) -------------------- */
/* Earned: a navy ink seal with a thin metal rim for its tier and the
   music glyph in paper white, like the notation on the score. Locked: a
   blank paper seal with a dashed rule and a faint glyph. */
.msx-emblem{display:block;flex:none;overflow:visible;filter:drop-shadow(0 3px 6px rgba(32,43,58,.14))}
.msx-shine{display:none}
.msx-glyph{font:400 30px/1 Bravura,serif;opacity:0;transition:opacity .2s}
.msx-glyph-holder.is-fitted .msx-glyph{opacity:1}
.msx-edge{fill:var(--tier,#a7b2c0);stroke:none}
.msx-rim{fill:#fff;stroke:none}
.msx-face{fill:var(--ms-ink);stroke:none}
.msx-ring{fill:none;stroke:var(--tier,#a7b2c0);stroke-width:.8;opacity:.75}
.msx-glyph{fill:#f7f4ec}
.msx-bronze{--tier:var(--ms-bronze)}
.msx-silver{--tier:var(--ms-silver)}
.msx-gold{--tier:var(--ms-goldmetal)}
.msx-platinum{--tier:var(--ms-platinum)}
.msx-locked{filter:none}
.msx-locked .msx-edge{fill:none;stroke:var(--ms-rule-strong);stroke-width:1.2;stroke-dasharray:2.2 2.4}
.msx-locked .msx-rim{fill:#fff}
.msx-locked .msx-face{fill:#f3f6f9}
.msx-locked .msx-ring{stroke:none}
.msx-locked .msx-glyph{fill:#b9c4d0}
.msx-lock circle{fill:#fff;stroke:var(--ms-rule-strong);stroke-width:1.2}
.msx-lock rect{fill:var(--ms-ink-faint)}
.msx-lock path{stroke:var(--ms-ink-faint);stroke-width:1.5}
/* Where an achievement sits: a dot in its tier's metal and plain words. */
.msx-tier{display:inline-flex;align-items:center;gap:6px;white-space:nowrap;
  font:500 11.5px/1 "DM Sans",system-ui,sans-serif;color:var(--ms-ink-soft)}
.msx-tier-dot{width:7px;height:7px;border-radius:50%;flex:none;background:var(--tier)}
.msx-tier-bronze{--tier:var(--ms-bronze)}.msx-tier-silver{--tier:var(--ms-silver)}
.msx-tier-gold{--tier:var(--ms-goldmetal)}.msx-tier-platinum{--tier:var(--ms-platinum)}

/* ---------- Tabs: My Sketches | Achievements ------------------------- */
.ms-tabs{display:flex;width:max-content;max-width:100%;margin:-14px auto 36px;padding:4px;gap:2px;
  border:1px solid var(--ms-rule);border-radius:999px;background:rgba(255,255,255,.88);
  box-shadow:0 10px 28px rgba(36,51,74,.05);
  backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px)}
.ms-tabs a{display:inline-flex;align-items:center;justify-content:center;min-height:36px;padding:8px 20px;border-radius:999px;
  color:var(--ms-ink-soft);text-decoration:none;font:600 12.5px/1 "DM Sans",system-ui,sans-serif;
  transition:background-color .2s,color .2s}
.ms-tabs a:hover{color:var(--ms-ink);background:var(--ms-wash)}
.ms-tabs a:focus-visible{outline:2px solid var(--ms-score);outline-offset:2px}
.ms-tabs a[aria-current="page"]{background:var(--ms-ink);color:#fff}
@media(max-width:650px){.ms-tabs{margin:-8px auto 26px}.ms-tabs a{padding:8px 16px;font-size:12px}}
.ms-tabs a{white-space:nowrap}
@media(max-width:400px){.ms-tabs a{padding-inline:11px}}

/* ---------- Sketch page: Submit invites a click once requirements are met */
html.public-sketch-ui body:not(.creator-mode) .challenge-constraints[data-state="complete"] ~ .submit-bar .submit-main:not(:disabled){
  animation:ms-play-ready 2.2s ease-out infinite;
}
@keyframes ms-play-ready{0%{box-shadow:0 0 0 0 rgba(49,87,126,.32)}70%,100%{box-shadow:0 0 0 9px rgba(49,87,126,0)}}
html.public-sketch-ui body:not(.creator-mode) .submit-bar{position:relative}

/* ---------- Completion: one celebration, then what's next ------------- */
html.public-sketch-ui .completion-dialog[open]{animation:ms-play-dialog .45s var(--ms-ease) both}
@keyframes ms-play-dialog{from{opacity:0;transform:translateY(12px) scale(.98)}to{opacity:1;transform:none}}
.ms-rewards{display:grid;gap:10px;margin:0 0 14px;text-align:left}
.ms-unlocked{text-align:center;padding:16px 12px 14px;border-radius:16px;background:var(--ms-paper);border:1px solid var(--ms-rule)}
.ms-unlocked-kicker{margin:0 0 12px!important;font:600 12.5px/1.2 "DM Sans",sans-serif!important;color:var(--ms-ink-soft)!important}
.ms-unlocked-list{display:flex;justify-content:center;flex-wrap:wrap;gap:14px 24px}
.ms-unlocked-item{display:grid;justify-items:center;gap:6px;animation:ms-play-unlock .6s var(--ms-delay,.5s) var(--ms-ease) both}
.ms-unlocked-item strong{margin-top:2px;font:700 21px/1 "Caveat","Segoe Print",cursive;color:var(--ms-ink)}
@keyframes ms-play-unlock{0%{opacity:0;transform:scale(.6)}100%{opacity:1;transform:none}}
.ms-reward-goals{display:grid;gap:8px}
.ms-reward-goal{
  display:flex;align-items:center;gap:10px;padding:9px 12px;border-radius:12px;
  background:var(--ms-wash);border:1px solid transparent;color:var(--ms-ink-soft);font:500 12px/1.3 "DM Sans",sans-serif;
  text-decoration:none;transition:background-color .2s,border-color .2s;
}
a.ms-reward-goal:hover{background:#eef3f8;border-color:var(--ms-rule)}
a.ms-reward-goal:focus-visible{outline:2px solid var(--ms-score);outline-offset:2px}
a.ms-reward-goal:hover .ms-quest-chevron{transform:translateX(2px);color:var(--ms-ink)}
.ms-reward-goal strong{color:var(--ms-ink);font-weight:700}
.ms-reward-goal .ms-chip-label{white-space:normal}
.ms-reward-goal .ms-bar{width:100%;min-width:140px}
.ms-reward-goal .ms-chip-body{flex:1}
.ms-reward-week.is-met{background:var(--ms-gold-soft);color:#7a5a1d}
/* The burst layer floats over whatever it was added to. */
.ms-burst{position:absolute;width:0;height:0;pointer-events:none;z-index:50}
.ms-burst-note{
  position:absolute;left:0;top:0;font:400 26px/1 Bravura,serif;opacity:0;
  animation:ms-play-burst 1.5s var(--delay,0ms) cubic-bezier(.15,.7,.3,1) forwards;
}
@keyframes ms-play-burst{
  0%{opacity:0;transform:translate(-50%,-50%) scale(.3)}
  15%{opacity:1}
  70%{opacity:1}
  100%{opacity:0;transform:translate(calc(-50% + var(--dx)),calc(-50% + var(--dy) + 60px)) rotate(var(--spin)) scale(1)}
}

/* ---------- Profile: rank summary ------------------------------------ */
.ms-profile-rank{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;column-gap:14px;row-gap:12px;
  margin:4px 0 20px;padding:14px 16px;text-align:left;border-radius:16px;border:1px solid var(--ms-rule);background:var(--ms-paper)}
.ms-profile-rank-body{min-width:0}
.ms-profile-rank-eyebrow{margin:0;font:500 11.5px/1.2 "DM Sans",sans-serif;color:var(--ms-ink-faint)}
.ms-profile-rank-name{margin:2px 0 7px;font:700 27px/1 "Caveat","Segoe Print",cursive;color:var(--ms-ink)}
.ms-profile-rank .ms-bar{width:100%}
.ms-profile-rank-meta{margin:7px 0 0;font:500 11.5px/1.3 "DM Sans",sans-serif;color:var(--ms-ink-soft)}
.ms-profile-rank-link{grid-column:1/-1;display:flex;align-items:center;justify-content:center;gap:6px;min-height:40px;
  border-radius:12px;border:1px solid var(--ms-rule-strong);background:#fff;color:var(--ms-ink);text-decoration:none;
  font:600 12.5px/1 "DM Sans",sans-serif;transition:background-color .2s,border-color .2s}
.ms-profile-rank-link:hover{background:var(--ms-wash);border-color:#bccad8}
.ms-profile-rank-link:focus-visible{outline:2px solid var(--ms-score);outline-offset:2px}
.ms-profile-rank-link::after{content:"\203A";font-size:17px;line-height:1;transform:translateY(-1px)}

/* ---------- Short screens and reduced motion --------------------------- */
@media(max-height:540px){
  .ms-home-progress{padding:3px 10px;margin-top:0}
  .ms-home-progress .ms-quest{display:none!important}
}
@media(prefers-reduced-motion:reduce){
  html body.home-page .challenge-link .arrow,.ms-home-progress,.ms-bar-fill,.ms-unlocked-item,
  html.public-sketch-ui .completion-dialog[open],
  html.public-sketch-ui body:not(.creator-mode) .challenge-constraints[data-state="complete"] ~ .submit-bar .submit-main:not(:disabled){animation:none!important}
  .ms-quest-goal,.ms-quest-chevron,.ms-reward-goal,.ms-tabs a,.ms-profile-rank-link{transition:none}
}
