#sheet:is([data-kind="shortfall"], [data-kind="task-incomplete"]) {
  --mascot-dialog-width: min(calc(var(--phone-width) * .84), 348px);
  --mascot-dialog-headroom: .37;
  --mascot-dialog-title-top: .184;
  inset: 0;
  width: var(--mascot-dialog-width);
  max-height: none;
  margin: auto;
  overflow: visible;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
#sheet[data-kind="task-incomplete"] {
  --mascot-dialog-width: min(calc(var(--phone-width) * .86), 370px);
  --mascot-dialog-headroom: .319;
  --mascot-dialog-title-top: .163;
}

#sheet:is([data-kind="shortfall"], [data-kind="task-incomplete"])::backdrop { background: #29160c9c; }
#sheet:is([data-kind="shortfall"], [data-kind="task-incomplete"]) .sheet-inner {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-areas: "card" "close";
  grid-template-columns: minmax(0, 1fr);
  padding: calc(var(--mascot-dialog-width) * var(--mascot-dialog-headroom)) 0 0;
  text-align: center;
}
#sheet:is([data-kind="shortfall"], [data-kind="task-incomplete"]) .sheet-head { display: contents; }
#sheet:is([data-kind="shortfall"], [data-kind="task-incomplete"]) #sheet-title {
  grid-area: card;
  place-self: start center;
  z-index: 2;
  margin-top: calc(var(--mascot-dialog-width) * var(--mascot-dialog-title-top));
  color: var(--ink);
  font-size: clamp(22px, calc(var(--mascot-dialog-width) * .086), 30px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: .04em;
  pointer-events: none;
}
#sheet:is([data-kind="shortfall"], [data-kind="task-incomplete"]) #sheet-body { grid-area: card; }
#sheet:is([data-kind="shortfall"], [data-kind="task-incomplete"]) .close-btn {
  grid-area: close;
  justify-self: center;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-top: 11px;
  padding: 0 0 3px;
  border: 1px solid #fff4d3b5;
  border-radius: 50%;
  background: #50302162;
  color: var(--close-on-accent);
  font: 30px/1 Arial, sans-serif;
}
#sheet:is([data-kind="shortfall"], [data-kind="task-incomplete"]) .close-btn:focus-visible { outline-color: #fff9ea; }

.mascot-dialog-card {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  padding-top: 29.5%;
  border: 2px solid #fff7e5;
  border-radius: clamp(22px, calc(var(--mascot-dialog-width) * .108), 36px);
  background: radial-gradient(ellipse 86% 55% at 0% 0%, #ffe5a5, transparent 72%),
    radial-gradient(ellipse 90% 52% at 100% -2%, #ffc7b5, transparent 78%),
    linear-gradient(#fff0ca, #fff9ee 49%, #fffcf6);
  box-shadow: 0 0 34px #ffa34c50, 0 14px 42px #48230860, inset 0 2px 1px #fffef6;
}
.mascot-dialog-light {
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  height: 64%;
  overflow: hidden;
  border-radius: inherit;
  background: radial-gradient(ellipse 55% 50% at 50% 2%, #fffceb, transparent 86%);
  pointer-events: none;
}
.mascot-dialog-light::before {
  content: "";
  position: absolute;
  inset: 0 18% auto;
  height: 94%;
  opacity: .4;
  background: repeating-conic-gradient(from 12deg at 50% 52%, #fff9c876 0 12deg, transparent 12deg 28deg);
  mask-image: radial-gradient(ellipse, #000 4%, transparent 66%);
}
.mascot-dialog-light::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 64%;
  background: radial-gradient(circle, #edab465c 1px, transparent 1.7px) 0 0 / 8px 8px;
  mask-image: radial-gradient(ellipse at 1% 0, #000, transparent 63%);
}
.mascot-dialog-hero {
  position: absolute;
  top: 0;
  left: 50%;
  width: 54%;
  translate: -50% -73%;
  transform-origin: 50% 73%;
  pointer-events: none;
}
.mascot-dialog-sheep { display: block; width: 100%; height: auto; filter: drop-shadow(0 5px 6px #a75b3538); }
.shortfall-coin {
  position: absolute;
  right: -1%;
  bottom: 2%;
  width: 25%;
  height: auto;
  rotate: 14deg;
  filter: drop-shadow(0 3px 4px #b7652349);
}
.mascot-dialog-star {
  position: absolute;
  width: 10%;
  aspect-ratio: 1;
  background: #fffdf3;
  clip-path: polygon(50% 0, 62% 37%, 100% 50%, 62% 63%, 50% 100%, 38% 63%, 0 50%, 38% 37%);
}
.mascot-dialog-star:nth-of-type(1) { top: 56%; left: -15%; }
.mascot-dialog-star:nth-of-type(2) { top: 48%; right: -11%; width: 8%; }
.shortfall-copy { padding: 0 8% 6%; }
.shortfall-gap {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: .33em;
  color: #8b401f;
  font-size: clamp(15px, 6.1cqw, 21px);
  font-weight: 800;
  line-height: 1.05;
}
.shortfall-gap strong {
  color: #dc3b14;
  font: 900 clamp(48px, 20cqw, 67px)/1 Arial, sans-serif;
  letter-spacing: -.06em;
  font-variant-numeric: tabular-nums;
}
.shortfall-meter {
  display: grid;
  gap: 6px;
  margin: 13px 0;
  padding: 9px 12px 11px;
  border: 1px solid #f1d8b1;
  border-radius: 13px;
  background: #fffcf4bb;
  text-align: start;
}
.shortfall-meter-labels {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 3px 10px;
  color: var(--muted);
  font-size: 12px;
}
.shortfall-meter-labels b { color: #a9401d; font-variant-numeric: tabular-nums; }
.shortfall-track { height: 6px; overflow: hidden; border-radius: 999px; background: #f4ddc1; }
.shortfall-track span {
  display: block;
  width: var(--shortfall-progress);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff9b34, #ee542a);
  transform-origin: left;
}
.mascot-dialog-cta {
  width: 100%;
  min-height: clamp(44px, 15.8cqw, 54px);
  border: 1px solid #ffcf9a;
  border-radius: 999px;
  background: radial-gradient(ellipse 70% 65% at 40% 0, #ffc768b3, transparent 85%),
    linear-gradient(100deg, #ff8d20, #f34619);
  color: var(--text-on-accent);
  box-shadow: 0 5px 13px #f5672940, inset 0 1px 0 #fff4c18f;
  font-size: clamp(15px, 6.8cqw, 21px);
  font-weight: 900;
}
.mascot-dialog-cta span { margin-left: 3px; }

#sheet[data-kind="task-incomplete"] #sheet-title {
  font-size: clamp(18px, calc(var(--mascot-dialog-width) * .088), 32px);
  letter-spacing: .015em;
}

#sheet[data-kind="task-incomplete"] .mascot-dialog-card { padding-top: 28.6%; }

#sheet[data-kind="task-incomplete"] .mascot-dialog-hero {
  width: 56.2%;
  translate: -52% -72%;
}

#sheet[data-kind="task-incomplete"] .mascot-dialog-star:nth-of-type(1) { top: 56%; left: -8%; }
#sheet[data-kind="task-incomplete"] .mascot-dialog-star:nth-of-type(2) { top: 48%; right: -12%; }

#sheet[data-kind="task-incomplete"] .close-btn { margin-top: clamp(12px, 5.3cqw, 28px); }

.incomplete-copy { padding: 0 7% 6%; }

.incomplete-note {
  color: var(--muted);
  font-size: clamp(12px, 4.7cqw, 17px);
  line-height: 1.45;
}

.incomplete-reward {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: clamp(10px, 4.7cqw, 18px) 0 0;
  padding: clamp(6px, 2.15cqw, 9px) clamp(8px, 3.4cqw, 13px);
  border-color: #fff;
  border-radius: 999px;
  background: #faecd97d;
  color: var(--muted);
  font-size: clamp(12px, 4.55cqw, 16px);
  line-height: 1.2;
}

.incomplete-reward strong {
  color: #c34404;
  font-size: clamp(16px, 5.8cqw, 22px);
  font-weight: 850;
  white-space: nowrap;
}

.incomplete-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.22fr);
  gap: clamp(8px, 2.8cqw, 11px);
  margin-top: clamp(16px, 6.5cqw, 24px);
}

.incomplete-actions .button {
  padding-inline: 6px;
  font-size: clamp(13px, 5.25cqw, 19px);
  white-space: nowrap;
}

.incomplete-later {
  border: 1px solid #fff;
  border-radius: 999px;
  background: #fff3df;
  box-shadow: none;
  color: #f76c2a;
  font-weight: 650;
}

@media (prefers-reduced-motion: no-preference) {
  #sheet:is([data-kind="shortfall"], [data-kind="task-incomplete"])[open] .sheet-inner { animation: sheet-in .26s ease-out both; }
  #sheet:is([data-kind="shortfall"], [data-kind="task-incomplete"])[open] .mascot-dialog-hero { animation: shortfall-peek .4s ease-out .06s both; }
  #sheet:is([data-kind="shortfall"], [data-kind="task-incomplete"])[open] .mascot-dialog-light::before { animation: shortfall-glow .68s ease-out .06s both; }
  #sheet[data-kind="shortfall"][open] .shortfall-track span { animation: shortfall-fill .36s ease-out .17s both; }
  #sheet:is([data-kind="shortfall"], [data-kind="task-incomplete"])[data-closing] .sheet-inner { animation: shortfall-exit .16s ease-in both; }
  #sheet:is([data-kind="shortfall"], [data-kind="task-incomplete"])[data-closing]::backdrop { animation: shortfall-exit .16s ease-in both; }
}
@keyframes shortfall-peek {
  from { transform: translateY(7px) scale(.91); opacity: 0; }
  68% { transform: translateY(-2px) scale(1.027); opacity: 1; }
  to { transform: none; opacity: 1; }
}
@keyframes shortfall-glow {
  from { scale: .64; opacity: 0; }
  54% { scale: 1.07; opacity: .75; }
  to { scale: 1; opacity: .4; }
}
@keyframes shortfall-fill { from { scale: 0 1; } }
@keyframes shortfall-exit { to { opacity: 0; } }
