:root {
  --paper:#fffefa;
  --ink-2:#3c315c;
  --indigo:#4f5bf5;
  --font:Inter,system-ui,sans-serif;
}
* {
  box-sizing:border-box;
}
body {
  margin:0;
  height:100dvh;
  overflow:hidden;
  background:radial-gradient(circle at 88% 14%,#d9adf7,transparent 64%),linear-gradient(155deg,#e9e1fa,#adcde9);
  font-family:var(--font);
}
main {
  display:grid;
  place-items:center;
  height:100%;
}
.printer {
  --sticker-size: clamp(72px, 8.8vw, 122px);
  justify-self: start;
  position: relative;
  width: min(calc(100% - var(--sticker-size)), 430px);
  min-width: 0;
  isolation: isolate;
}
.stickers {
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
}
.sticker {
  position: absolute;
  width: var(--sticker-size);
  height: auto;
  transform: rotate(var(--tilt));
  animation: float 5s ease-in-out infinite alternate;
  animation-delay: var(--delay);
  filter: drop-shadow(0 12px 16px #534c9e36);
}
.sticker.food {
  right: 97%;
  top: 4%;
  --drift: -15px;
  --tilt: -13deg;
  --delay: -.8s;
}
.sticker.groceries {
  left: 96%;
  top: -9%;
  --drift: 16px;
  --tilt: 13deg;
  --delay: -2s;
}
.sticker.transit {
  right: 96%;
  bottom: 16%;
  --drift: -12px;
  --tilt: -16deg;
  --delay: -1.6s;
}
.sticker.gifts {
  left: 97%;
  bottom: 12%;
  --drift: 14px;
  --tilt: 11deg;
  --delay: -2.8s;
}
@keyframes float {
  to {
    transform: translate(var(--drift), -18px) rotate(var(--tilt));
  }
}
.printer-top {
  position: relative;
  z-index: 3;
  height: 53px;
  margin-inline: 6%;
  border: 1px solid #ffffffba;
  border-radius: 23px;
  background: linear-gradient(165deg, #f9f5ff, #c9c4ec 72%, #b7b5e2);
  box-shadow: 0 17px 32px #2e245333, inset 0 -2px 0 #8580af2e;
}
.printer-label {
  position: absolute;
  top: 7px;
  left: 8%;
  color: #413963;
  font: 700 12px/1.25 var(--font);
  letter-spacing: .015em;
}
.slot {
  position: absolute;
  bottom: 6px;
  left: 4%;
  right: 4%;
  height: 14px;
  border-radius: 20px;
  background: #272442;
  box-shadow: inset 0 2px 5px #110f24, 0 1px 0 #fff9;
}
.slot::after {
  content: "";
  position: absolute;
  inset: 7px 8% 0;
  height: 2px;
  background: #9c9dff;
  box-shadow: 0 0 8px #797dff;
}
.led {
  position: absolute;
  top: 11px;
  right: 19px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2ff1a6;
  box-shadow: 0 0 8px #6bffc5;
}
.paper-clip {
  position: relative;
  z-index: 4;
  margin: -12px auto 0;
  width: calc(81% - 18px);
  padding-bottom: 30px;
}
.paper-clip:not(.released) {
  clip-path: inset(0 -100px -100px);
}
.receipt {
  position: relative;
  padding: 25px clamp(15px, 3vw, 31px) 18px;
  min-width: 0;
  background: linear-gradient(#cdc9df, var(--paper) 25px);
  color: #262238;
  filter: drop-shadow(0 10px 10px #3125573b);
  transform-origin: 50% 8px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  font: 600 12px / 1.4 ui-monospace, Menlo, Consolas, monospace;
}
.held .receipt {
  cursor: grabbing;
}
.paper-clip:not(.released) .receipt::before {
  position: absolute;
  bottom: 100%;
  inset-inline: 0;
  height: 20px;
  content: "";
  background: #cdc9df;
}
.receipt::after {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 7px;
  content: "";
  background: radial-gradient(circle at 50% 0, var(--paper) 0 6px, transparent 6.6px) repeat-x;
  background-size: 15px 7px;
}
.receipt-fold {
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(102deg, transparent 12%, #5d526b17 27%, #ffffffcc 39%,
      #55476522 53%, #ffffffcc 65%, #61556c10 76%, transparent 88%);
  transition: opacity .16s ease-out;
}
.tension .receipt-fold {
  opacity: 1;
  transition-duration: .08s;
}
.perforation {
  position: absolute;
  top: 12px;
  left: 4%;
  right: 4%;
  border-top: 1px dashed #79708c;
  opacity: .5;
  transition: border-color .15s, opacity .15s;
}
.tension .perforation {
  border-color: var(--indigo);
  opacity: 1;
}
.released .receipt {
  pointer-events: none;
}
.released .perforation {
  opacity: 0;
}
.receipt.is-detached {
  visibility: hidden;
}
.receipt-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px 13px;
  flex-wrap: wrap;
  min-height: 38px;
  margin-top: -12px;
}
.receipt-hint {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
  text-align: center;
}
.receipt-action {
  border: 1px solid #4f5bf54a;
  border-radius: 999px;
  padding: 6px 15px;
  min-height: 36px;
  color: #343ab1;
  background: #ffffff8a;
  cursor: pointer;
  font: 700 14px var(--font);
}
.receipt-action:hover {
  background: #fff;
}
.receipt-action[aria-disabled="true"] {
  opacity: .55;
  cursor: default;
}
.receipt-header, .item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.receipt-header {
  padding-bottom: 10px;
  border-bottom: 1px dashed #8b859b;
}
.receipt-header span:first-child {
  letter-spacing: .05em;
}
.receipt-header span:last-child {
  color: #635a7a;
  white-space: nowrap;
}
.dots {
  display: grid;
  grid-template: repeat(7, minmax(0, 1fr)) / repeat(21, minmax(0, 1fr));
  align-items: center;
  width: min(100%, 300px);
  aspect-ratio: 21 / 9;
  margin: 19px auto;
  color: var(--indigo);
}
.dots span {
  aspect-ratio: 1;
  background: currentColor;
  clip-path: polygon(43% 6%, 57% 6%, 57% 37%, 84% 22%, 91% 34%, 64% 50%, 91% 66%, 84% 78%,
      57% 63%, 57% 94%, 43% 94%, 43% 63%, 16% 78%, 9% 66%, 36% 50%, 9% 34%, 16% 22%, 43% 37%);
}
.item {
  padding-block: 7px;
}
.total {
  border-top: 1px dashed #8b859b;
  padding-block: 8px;
  font-weight: 800;
}
.barcode {
  height: 29px;
  width: 76%;
  margin: 9px auto 10px;
  background: repeating-linear-gradient(90deg, #282438 0 2px, transparent 2px 4px,
      #282438 4px 5px, transparent 5px 9px, #282438 9px 12px, transparent 12px 15px,
      #282438 15px 16px, transparent 16px 20px, #282438 20px 22px, transparent 22px 23px);
}
.receipt-note {
  margin: 0;
  text-align: center;
  color: #696278;
  font-size: 10px;
}
.printer {
  --sticker-size:clamp(44px,12vw,88px);
  width:min(calc(100% - 100px),300px);
  justify-self:center;
}
.sticker.food,.sticker.transit {
  right:93%;
}
.sticker.groceries,.sticker.gifts {
  left:93%;
}
.sticker.groceries {
  top:2%;
}
.printer-top {
  height:42px;
}
.slot {
  height:11px;
  bottom:5px;
}
.printer-label {
  top:6px;
}
.paper-clip {
  margin-top:-9px;
  padding-bottom:18px;
}
.receipt {
  padding:16px 12px 10px;
  font-size:10px;
}
.receipt-header {
  padding-bottom:6px;
}
.dots {
  margin:10px auto;
}
.item {
  padding-block:4px;
}
.barcode {
  height:17px;
  margin-block:6px;
}
.receipt-note {
  font-size:8px;
}
.receipt-controls {
  margin-top:-6px;
  min-height:38px;
  gap:3px 8px;
}
.receipt-hint {
  font-size:11px;
}
.receipt-action {
  font-size:12px;
  padding-inline:9px;
}
.led {
  top:8px;
}
.receipt-action:focus-visible {
  outline:3px solid #211b95;
  outline-offset:4px;
}
@media (max-width:370px) {
  .printer {
    width:min(calc(100% - 74px),278px);
  }
  .receipt-note {
    display:none;
  }
  .receipt-controls {
    width:calc(100% + 36px);
    margin-inline:-18px;
  }
  .sticker {
    max-width:48px;
  }
}
@media(prefers-reduced-motion:reduce) {
  .sticker {
    animation:none;
  }
  .perforation,.receipt-fold {
    transition:none;
  }
}
