html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: transparent;
}

#stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: transparent;
  pointer-events: none;
}

#wall, #lane {
  position: absolute;
  inset: 0;
}

#wall { z-index: 1; }
#lane { z-index: 2; }

.bit {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 18%;
  object-fit: contain;
  background: transparent;
  filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.28));
}

.walker {
  position: absolute;
  left: 0;
  bottom: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: var(--w, 96px);
  overflow: visible;
  will-change: transform;
}

.walker .body {
  position: relative;
  width: var(--w, 96px);
  height: var(--w, 96px);
  transform-origin: 50% 70%;
}

.walker .shadow {
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 2%;
  height: 12%;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  transform: scaleY(0.55);
  z-index: 0;
}

.walker canvas.sprite {
  position: relative;
  z-index: 1;
  display: block;
  width: var(--w, 96px);
  height: var(--w, 96px);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.walker img.hat {
  position: absolute;
  z-index: 2;
  left: 0;
  top: 0;
  display: none;
  pointer-events: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.say {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 2px);
  z-index: 6;
  width: max-content;
  max-width: 320px;
  transform: translateX(calc(-50% + var(--shift, 0px)));
  pointer-events: none;
  font-family: "Pixelify Sans", Fredoka, "Trebuchet MS", sans-serif;
  font-size: max(16px, calc(var(--w, 96px) * 0.2));
  font-weight: 500;
  line-height: 1.25;
  color: var(--text, #1a1408);
}

.say-pop {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: calc(50% + var(--tail, 0px)) 100%;
  animation: say-pop 0.48s cubic-bezier(0.2, 1.35, 0.36, 1) both;
  filter: drop-shadow(4px 4px 0 var(--accent, #2f9bff));
}

.say.bye .say-pop {
  animation: say-bye 0.22s ease-in forwards;
}

@keyframes say-pop {
  0% { transform: scale(0.15); }
  52% { transform: scale(1.14); }
  74% { transform: scale(0.94); }
  100% { transform: scale(1); }
}

@keyframes say-bye {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.18); opacity: 0; }
}

.say-frame {
  max-width: 100%;
  background: var(--ink, #1a1408);
  padding: 4px;
  clip-path: polygon(
    8px 0, calc(100% - 8px) 0,
    100% 8px, 100% calc(100% - 8px),
    calc(100% - 8px) 100%, 8px 100%,
    0 calc(100% - 8px), 0 8px
  );
}

.say-box {
  max-width: 280px;
  max-height: 5.4em;
  overflow: hidden;
  padding: 5px 10px 6px;
  background: var(--fill, #fff);
  color: var(--text, #1a1408);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.say-emote {
  height: 1.25em;
  width: auto;
  vertical-align: -0.28em;
  margin: 0 1px;
}

.say-tail {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: -4px;
  position: relative;
  z-index: 1;
}

.say-tail i {
  display: block;
  height: 4px;
  background: var(--fill, #fff);
  box-shadow:
    -4px 0 0 0 var(--ink, #1a1408),
    4px 0 0 0 var(--ink, #1a1408);
}

.say-tail i:nth-child(1) { width: 28px; }
.say-tail i:nth-child(2) { width: 20px; }
.say-tail i:nth-child(3) { width: 12px; }
.say-tail i:nth-child(4) {
  width: 4px;
  box-shadow:
    -4px 0 0 0 var(--ink, #1a1408),
    4px 0 0 0 var(--ink, #1a1408),
    0 4px 0 0 var(--ink, #1a1408);
}

.walker .nm {
  position: relative;
  z-index: 3;
  max-width: calc(var(--w, 96px) + 56px);
  margin-bottom: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: Fredoka, "Trebuchet MS", sans-serif;
  font-size: max(12px, calc(var(--w, 96px) * 0.16));
  font-weight: 600;
  line-height: 1.1;
  color: #fff;
  text-shadow: 0 1px 0 #10141C, 0 2px 6px rgba(0, 0, 0, 0.85);
}

body.is-preview {
  background: linear-gradient(#243356, #10141c);
}

body.is-preview #stage::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 18px;
  z-index: 0;
  background: linear-gradient(transparent, rgba(255, 255, 255, 0.16));
  pointer-events: none;
}

.sb-note {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 5;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(16, 20, 28, 0.82);
  color: #ffe7a3;
  font-family: Fredoka, "Trebuchet MS", sans-serif;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sb-note.show { opacity: 1; }
