/* Musical Sketch: the hand-drawn layer of the sticker album.
   Loaded right after ms-sticker.css on every public page. The stickers stay
   as they are; this adds a light hand-drawn touch on top: pencil outlines
   with wobbly corners, a pencil drop shadow, crayon-filled piano keys and
   squiggle underlines under the big titles. Rules here share the sticker
   theme's specificity and win by coming later. */
html{
  --sk-pencil:#3a4556;--sk-pencil-soft:rgba(58,69,86,.5);--sk-shadow:rgba(38,49,63,.14);
  --sk-wobble:24px 30px 22px 32px/30px 22px 32px 24px;
  --sk-wobble-sm:15px 19px 14px 20px/19px 14px 20px 15px;
  --sk-pill:26px 20px 28px 19px/20px 28px 19px 26px;
  --sk-crayon:repeating-linear-gradient(-35deg,rgba(255,255,255,.3) 0 1.5px,transparent 1.5px 5px);
  --sk-squiggle:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 10' preserveAspectRatio='none'%3E%3Cpath d='M2 6.5C12 2.5 20 2.8 30 5.6S48 8.4 58 5.2 76 2.2 86 5.1 104 8 118 3.8' fill='none' stroke='%23ff7a6b' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* ---------- Cards: a pencil outline and a pencil shadow ----------------- */
html body :is(.ms-home-progress,.info-panel,.info-feature,.info-credits,.info-contact-panel,.auth-card,.library-board,.verify-card,.username-card,
  .tutorial-guide,.challenge-constraints,.ach-hero,.ach-next,.ach-track,.ach-recent,.ach-card,.composition){
  border:0!important;border-radius:var(--sk-wobble)!important;box-shadow:0 0 0 2px var(--sk-pencil),3px 4px 0 2px var(--sk-shadow)!important}
html body :is(.ms-profile-rank,.ms-unlocked,.completion-metric,.ach-track-next,.ach-stats){
  border:1.5px dashed var(--sk-pencil-soft)!important;border-radius:var(--sk-wobble-sm)!important;box-shadow:none!important}
/* Pencil lines on cards and buttons are ring shadows drawn outside the box,
   so style B never changes a layout that style A measures to the pixel. */
html body :is(.completion-dialog,.confirm,dialog.feedback-dialog,.cadence-feedback-dialog){
  border:0!important;border-radius:var(--sk-wobble)!important;box-shadow:0 0 0 2px var(--sk-pencil),0 0 0 6px #fff,5px 7px 0 6px rgba(38,49,63,.18)!important}
html body .home-profile-menu{border:0!important;border-radius:var(--sk-wobble-sm)!important;box-shadow:0 0 0 2px var(--sk-pencil),3px 4px 0 2px var(--sk-shadow)!important}

/* ---------- Buttons: stickers outlined in pencil ------------------------ */
html body :is(.challenge-link,.info-primary,.account-primary,.email-submit,.username-submit,.sketch-button.primary,.button-link,
  .success-btn,#confirmSubmitBtn,#tryTodayChallenge),
html.public-sketch-ui body:not(.creator-mode) :is(.submit-main,.tutorial-actions button.primary){
  border:0!important;border-radius:var(--sk-wobble-sm)!important;box-shadow:0 0 0 2px var(--sk-pencil),3px 3px 0 2px var(--sk-pencil)!important}
html body :is(.challenge-link,.info-primary,.account-primary,.email-submit,.username-submit,.sketch-button.primary,.button-link,.success-btn,#confirmSubmitBtn,#tryTodayChallenge):hover,
html.public-sketch-ui body:not(.creator-mode) :is(.submit-main,.tutorial-actions button.primary):hover:not(:disabled){
  box-shadow:0 0 0 2px var(--sk-pencil),5px 5px 0 2px var(--sk-pencil)!important}
html.public-sketch-ui body:not(.creator-mode) .submit-main:disabled{box-shadow:0 0 0 2px #9fb0c5,2px 2px 0 2px #c3cfdd!important}
html.ms-done-today body.home-page .challenge-link{box-shadow:0 0 0 2px var(--sk-pencil),3px 3px 0 2px var(--sk-pencil)!important}
html body :is(.home-tutorial-link,.home-auth-link,.hero-staff-control,.info-secondary,.info-back,.back-to-menu,.guest-link,.secondary-button,.nav-button,
  .ms-profile-rank-link,.ach-action,.secondary-btn,#cadenceFeedbackLaunch,.contact-launch,.sketch-button:not(.primary)),
html.public-sketch-ui body:not(.creator-mode) :is(.top-btn,.submit-secondary,.tutorial-actions button:not(.primary),.dialog-actions button:not(.danger-btn):not(.success-btn):not(#confirmSubmitBtn)){
  border:1.75px solid var(--sk-pencil)!important;border-radius:var(--sk-pill)!important;box-shadow:2px 2px 0 var(--sk-shadow)!important}
html body :is(.home-tutorial-link,.home-auth-link,.hero-staff-control,.info-secondary,.info-back,.back-to-menu,.guest-link,.secondary-button,.nav-button,
  .ms-profile-rank-link,.ach-action,.secondary-btn,#cadenceFeedbackLaunch,.contact-launch,.sketch-button:not(.primary)):hover,
html.public-sketch-ui body:not(.creator-mode) :is(.top-btn,.submit-secondary,.tutorial-actions button:not(.primary)):hover{
  border-color:var(--sk-pencil)!important;background:#fff8e1!important}
html body .logged-in-avatar,html body.home-page .home-profile-avatar{box-shadow:0 0 0 2px var(--sk-pencil),2px 3px 0 2px var(--sk-shadow)!important}

/* ---------- Form fields and tabs ---------------------------------------- */
html body :is(input[type="email"],input[type="password"],input[type="text"],input[type="search"],textarea):not(.score-wrap *){
  border:1.75px solid var(--sk-pencil)!important;border-radius:var(--sk-wobble-sm)!important}
html body :is(.ms-tabs,.tabs){border:1.75px solid var(--sk-pencil)!important;border-radius:var(--sk-pill)!important;box-shadow:2px 3px 0 var(--sk-shadow)!important}
html body .ms-tabs a[aria-current="page"],
html body .tabs .tab[aria-selected="true"]{border-radius:var(--sk-pill)!important;box-shadow:0 0 0 1.5px var(--sk-pencil)!important}

/* ---------- Squiggle underlines under the big titles -------------------- */
html body :is(.ach-section-head h2,.paper-heading h1,.auth-card h1,.verify-card h1,.username-card h1,.info-title,.library-title){
  background-image:var(--sk-squiggle)!important;background-repeat:no-repeat!important;background-position:50% 100%!important;background-size:min(100%,8em) .32em!important;padding-bottom:.2em!important}
html body .ach-section-head h2{background-position:0 100%!important}
/* Home: a coral squiggle under the title, as if underlined by hand. */
html body.home-page .brand-ink::before{content:"";position:absolute;left:4%;right:6%;bottom:-.02em;height:.13em;
  background:var(--sk-squiggle) center/100% 100% no-repeat;pointer-events:none;transform-origin:0 50%}

/* ---------- Seals: a pencil line around each die-cut sticker ------------ */
html body .msx-emblem{
  filter:drop-shadow(2.5px 0 0 #fff) drop-shadow(-2.5px 0 0 #fff) drop-shadow(0 2.5px 0 #fff) drop-shadow(0 -2.5px 0 #fff)
    drop-shadow(1.3px 0 0 var(--sk-pencil)) drop-shadow(-1.3px 0 0 var(--sk-pencil)) drop-shadow(0 1.3px 0 var(--sk-pencil)) drop-shadow(0 -1.3px 0 var(--sk-pencil))
    drop-shadow(2px 3px 0 var(--sk-shadow))}
html body .msx-locked{filter:none;border:2px dashed var(--sk-pencil-soft);border-radius:52% 46% 50% 48%/47% 53% 45% 55%}
html body .ms-quest .msx-locked{border-color:var(--tier,#ff7a6b)}

/* ---------- Piano keys: pencil-drawn, coloured in with crayon ------------ */
html body .ach-ladder{filter:drop-shadow(2px 3px 0 var(--sk-shadow))}
html body .ach-step{border-color:var(--sk-pencil);border-radius:0 0 12px 9px/0 0 10px 13px}
html body .ach-step:first-child{border-top-left-radius:5px}
html body .ach-step:last-child{border-top-right-radius:7px}
html body .ach-ladder .ach-step.is-earned{border-color:var(--sk-pencil);background-image:var(--sk-crayon);box-shadow:inset 0 -5px 0 rgba(0,0,0,.1)}
html body .ach-step.is-next{box-shadow:inset 0 0 0 2px var(--st-sun);background-image:repeating-linear-gradient(-35deg,rgba(255,190,46,.16) 0 1.5px,transparent 1.5px 6px)}
html body .ach-step:not(:last-child):not(:nth-child(7n+3)):not(:nth-child(7n))::after{
  background:var(--sk-pencil);border-radius:0 0 6px 4px/0 0 4px 7px;box-shadow:none}
/* The streak keyboard on the home page and completion screen. */
html .ms-streak-keys{filter:drop-shadow(2px 2.5px 0 var(--sk-shadow))}
html .ms-streak-key{stroke:var(--sk-pencil);stroke-width:1.7}
html .ms-streak-fill{stroke:var(--sk-pencil);stroke-width:1.7}
html .ms-streak-hatch{display:inline}
html .ms-streak-day.is-done:not(.is-run) .ms-streak-hatch{display:none}
html .ms-streak-black{fill:var(--sk-pencil)}

/* ---------- Progress bars: crayon fill inside a pencil outline ---------- */
html body .ms-bar{background:#fff;border:1.5px solid var(--sk-pencil);border-radius:8px 30px 10px 26px/16px 8px 14px 10px;box-sizing:border-box;height:9px}
html body .ms-bar-fill{background-image:var(--sk-crayon);border-radius:0}
html.public-sketch-ui body:not(.creator-mode) :is(.constraint-meter,.tutorial-progress-track){border:1.5px solid var(--sk-pencil);box-sizing:border-box}
html.public-sketch-ui body:not(.creator-mode) :is(#constraintMeterFill,.tutorial-progress-fill){background-image:var(--sk-crayon)!important}

/* ---------- Dashed lines become pencil dashes ---------------------------- */
html body .ach-stat:nth-child(odd){border-right:1.5px dashed var(--sk-pencil-soft)}
html body .ach-stat:nth-child(-n+2){border-bottom:1.5px dashed var(--sk-pencil-soft)}
html body.home-page .home-bottom-bar{border-top:1.5px dashed var(--sk-pencil-soft)}
html body .ms-streak-count{border-left:1.5px dashed var(--sk-pencil-soft)}

/* ---------- Small stickers elsewhere get a pencil outline too ------------ */
html body .calendar-day.has-sketches{box-shadow:0 0 0 2.5px #fff,0 0 0 4px var(--sk-pencil),2px 4px 0 3px var(--sk-shadow)!important}
html body.info-page .info-feature-number,
html body .verify-card .mark{box-shadow:0 0 0 2.5px #fff,0 0 0 4px var(--sk-pencil)!important}
html.public-sketch-ui body:not(.creator-mode) .constraint-chip,
html body.home-page .daily-footer .clock{box-shadow:0 0 0 2px #fff,0 0 0 3.5px var(--sk-pencil)!important}
html.public-sketch-ui body:not(.creator-mode) .icon-btn[aria-pressed="true"]:not(.voice-btn){border:1.75px solid var(--sk-pencil)!important;border-radius:var(--sk-wobble-sm)!important}
html body .ms-pip{box-shadow:0 0 0 1.3px var(--sk-pencil-soft)}
html body .ms-pip.is-done{box-shadow:0 0 0 1.3px var(--sk-pencil)}
