/* ===== character ===== */
:root {
  --c-sky: #8ba888;
  --c-sky-light: #a7c1a0;
  --c-cream: #f2ead9;
  --c-sand: #e4d8bf;
  --c-terracotta: #c96f4a;
  --c-terracotta-dark: #9c4f30;
  --c-forest: #4b6b4a;
  --c-forest-deep: #344d34;

  --c-ochre: #d99a3c;

  --bg-base: #ede4d1;

  --website-background: var(--bg-base);
  --black: #242424;
  --white: #fff;
  --komi-panel: transparent;
  --primary-color: #1c1a1a;
  --primary-color-dark: #0e0d0d;
  --primary-color-tint: #322e2e;
  --hair-line: #4a4340;
  --secondary-color: #d29f77;
  --accent-color: #f2695c;
  --sparkle-color: #ffe085;
  --shirt-color: #5f7d5a;
  --shirt-color-dark: #52704e;
  --shirt-color-dark-2: #46613f;
  --bow-color-1: var(--c-terracotta);
  --bow-color-2: var(--c-terracotta-dark);
  --bow-gradient: repeating-linear-gradient(
    -45deg,
    var(--bow-color-1) 0 0.25rem,
    var(--bow-color-2) 0.25rem 0.375rem
  );
  --line-width-1: 0.125rem;
  --line-width-2: 0.375rem;
}

img {
  width: 100%;
  z-index: 10;
  top: 3.3rem;
}

* {
  box-sizing: border-box;
}

body {
  display: grid;
  position: relative;
  place-items: center;
  background-color: var(--website-background);
  font-size: 16px;
  line-height: 1;
  font-family: "Kiwi Maru", serif;
  overflow-x: hidden;
}

.komi-container {
  position: relative;
  z-index: 4;
  transform-origin: 50% 88%;
  animation: komiBreathe 4.6s ease-in-out infinite;
}

@keyframes komiBreathe {
  0%,
  100% {
    transform: scaleY(1);
  }
  50% {
    transform: scaleY(1.012);
  }
}

@media (prefers-reduced-motion: reduce) {
  .komi-container {
    animation: none;
  }
}

.komi *,
.komi *::before,
.komi *::after {
  position: absolute;
}

.komi-head,
.komi-body,
.komi-hair-extension {
  animation: none;
}

.komi-eye {
  top: 4.5rem;
  right: var(--eye-right);
  bottom: auto;
  left: var(--eye-left);
  --flip: 1;
  --eye-offset: 1.25rem;
  --pupil-offset: 0.5rem;
  --eye-line-top-offset: -13%;
  --eye-line-bottom-offset: 16%;
  z-index: 2;
  height: 3.75rem;
  width: 4rem;
  transform-origin: center 70%;
  border-radius: 100%;
  background-color: var(--white);
  overflow: hidden;
}

.komi-eye.blink {
  animation: blinky 0.16s ease-out;
}

.komi-eye.wink {
  animation: winkClose 0.5s ease;
}

.komi-wink {
  top: 6.1rem;
  right: 1.95rem;
  width: 2.5rem;
  height: 1rem;
  border-bottom: 0.28rem solid var(--black);
  border-radius: 0 0 60% 60% / 0 0 100% 100%;
  opacity: 0;
  z-index: 3;
}

.komi-wink.show {
  animation: winkLid 0.5s ease;
}

.komi-blush.pop {
  animation: winkBlush 0.5s ease;
}

.komi-container.tilt {
  animation: winkTilt 0.5s ease;
}

.komi-eye::before,
.komi-eye::after {
  content: "";
}

.komi-eye::before {
  top: -0.0625rem;
  right: var(--eye-line-top-right);
  bottom: auto;
  left: var(--eye-line-top-left);
  height: 120%;
  width: 120%;
  transform: rotate(calc(-12deg * var(--flip)));
  border-radius: 100%;
  border: var(--line-width-2) solid transparent;
  border-top: var(--line-width-2) solid var(--black);
}

.komi-eye::after {
  top: auto;
  right: var(--eye-line-bottom-right);
  bottom: 0;
  left: var(--eye-line-bottom-left);
  height: 15%;
  width: 50%;
  transform: rotate(calc(8deg * var(--flip)));
  border-radius: 100%;
  border: var(--line-width-1) solid transparent;
  border-bottom: var(--line-width-1) solid var(--black);
}

.komi-eye-sparkle {
  inset: 15% 20%;
  transform: scale(var(--eye-sparkle-scale, 0));
  transition: 0.4s ease-in-out;
}

.komi-eye-sparkle::before,
.komi-eye-sparkle::after {
  content: "";
  border-radius: 100%;
  background-color: var(--sparkle-color);
}

.komi-eye-sparkle::before {
  left: 50%;
  height: 100%;
  width: 0.5rem;
  transform: translateX(-50%);
  animation: twinkleY 0.3s infinite;
}

.komi-eye-sparkle::after {
  top: 50%;
  width: 100%;
  height: 0.5rem;
  transform: translateY(-50%);
  animation: twinkleX 0.3s 0.3s infinite;
}

.komi-eye-gaze {
  inset: 0;
  will-change: transform;
}

.komi-eye-pupil {
  top: 0.75rem;
  right: var(--pupil-right);
  bottom: auto;
  left: var(--pupil-left);
  height: 2.5rem;
  width: 2.5rem;
  transform: scale(var(--eye-pupil-scale, 1));
  border-radius: 100%;
  background-color: var(--black);
  transition: 0.4s ease-in-out;
  overflow: hidden;
}

.komi-eye-pupil::before {
  content: "";
  top: 60%;
  left: 50%;
  height: 100%;
  width: 130%;
  transform: translateX(-50%);
  border-radius: 100%;
  background-color: var(--primary-color-tint);
}

.komi-eye-left {
  --eye-left: var(--eye-offset);
  --pupil-right: var(--pupil-offset);
  --eye-line-top-left: var(--eye-line-top-offset);
  --eye-line-bottom-left: var(--eye-line-bottom-offset);
}

.komi-eye-right {
  --flip: -1;
  --eye-right: var(--eye-offset);
  --pupil-left: var(--pupil-offset);
  --eye-line-top-right: var(--eye-line-top-offset);
  --eye-line-bottom-right: var(--eye-line-bottom-offset);
}

.komi-blush {
  top: 7.5rem;
  right: var(--blush-right);
  bottom: auto;
  left: var(--blush-left);
  --blush-offset: 0.75rem;
  height: 2rem;
  width: 2.5rem;
  border-radius: 100%;
  background-color: var(--accent-color);
  opacity: var(--blush-opacity, 0.22);
  transition: 0.8s;
}

.komi-blush-left {
  --blush-left: var(--blush-offset);
}

.komi-blush-right {
  --blush-right: var(--blush-offset);
}

.komi-ear {
  top: 5.75rem;
  right: var(--ear-right);
  bottom: auto;
  left: var(--ear-left);
  --flip: 1;
  --ear-offset: -1.25rem;
  height: 3rem;
  width: 2rem;
  transform: rotate(calc(40deg * var(--flip)));
  border-radius: 100%;
  background-color: var(--secondary-color);
}

.komi-ear-left {
  --flip: -1;
  --ear-left: var(--ear-offset);
  z-index: -1;
}

.komi-ear-right {
  --ear-right: var(--ear-offset);
}

.komi-cat-ear {
  top: var(--cat-ear-translate, 4rem);
  right: var(--cat-ear-right);
  bottom: auto;
  left: var(--cat-ear-left);
  --flip: 1;
  --cat-ear-offset: -3rem;
  --cat-ear-fur-offset: 20%;
  --cat-ear-fur-1-offset: 1.75rem;
  --cat-ear-fur-2-offset: 1.5rem;
  z-index: -1;
  height: 6rem;
  width: 5rem;
  /* fully hidden until she unlocks them; the tucked tips used to poke past
     the hair silhouette */
  opacity: 0;
  transition: 0.5s ease-in-out;
}

.komi-head.ears .komi-cat-ear {
  opacity: 1;
}

.komi-cat-ear::before {
  content: "";
  inset: 0;
  transform-origin: var(--cat-ear-transform-origin);
  transform: rotate(calc(30deg * var(--flip)));
  border-radius: inherit;
  background-color: var(--primary-color);
}

.komi-cat-ear-fur {
  top: 10%;
  right: var(--cat-ear-fur-right);
  bottom: auto;
  left: var(--cat-ear-fur-left);
  height: 70%;
  width: 70%;
  transform-origin: var(--cat-ear-transform-origin);
  transform: rotate(calc(30deg * var(--flip)));
  border-radius: inherit;
  background-color: var(--primary-color-tint);
}

.komi-cat-ear-fur::before,
.komi-cat-ear-fur::after {
  content: "";
  border-radius: var(--cat-ear-fur-border-radius);
  background-color: var(--primary-color);
}

.komi-cat-ear-fur::before {
  top: -0.625rem;
  right: var(--cat-ear-fur-1-right);
  bottom: auto;
  left: var(--cat-ear-fur-1-left);
  height: 2rem;
  width: 2rem;
  transform: rotate(calc(-70deg * var(--flip)));
}

.komi-cat-ear-fur::after {
  top: -0.25rem;
  right: var(--cat-ear-fur-2-right);
  bottom: auto;
  left: var(--cat-ear-fur-2-left);
  height: 1rem;
  width: 1rem;
  transform: rotate(calc(-50deg * var(--flip)));
}

.komi-cat-ear-left {
  --cat-ear-left: var(--cat-ear-offset);
  --cat-ear-transform-origin: right bottom;
  --cat-ear-fur-left: var(--cat-ear-fur-offset);
  --cat-ear-fur-1-left: var(--cat-ear-fur-1-offset);
  --cat-ear-fur-2-left: var(--cat-ear-fur-2-offset);
  --cat-ear-fur-border-radius: 0 100% 0 100%;
  border-radius: 0.5rem 0 0 100%;
}

.komi-cat-ear-right {
  --flip: -1;
  --cat-ear-right: var(--cat-ear-offset);
  --cat-ear-transform-origin: left bottom;
  --cat-ear-fur-right: var(--cat-ear-fur-offset);
  --cat-ear-fur-1-right: var(--cat-ear-fur-1-offset);
  --cat-ear-fur-2-right: var(--cat-ear-fur-2-offset);
  --cat-ear-fur-border-radius: 100% 0 100% 0;
  border-radius: 0 0.5rem 100% 0;
  animation: var(--cat-ear-animation);
}

.komi-face {
  inset: 0;
  background-color: var(--secondary-color);
  border-radius: 50% 50% 50% 40%;
}

/* hair coming down at the temples */
.komi-face::before,
.komi-face::after {
  content: "";
  top: 1rem;
  height: 5.5rem;
  width: 4rem;
  transform-origin: center top;
}

.komi-face::before {
  left: 1.2rem;
  top: 1.4rem;
  border-left: 1.25rem solid var(--primary-color);
  border-bottom-left-radius: 100%;
  transform: rotate(30deg);
}

.komi-face::after {
  right: 1.2rem;
  top: 1.4rem;
  border-right: 1.25rem solid var(--primary-color);
  border-bottom-right-radius: 100%;
  transform: rotate(-30deg);
}

.komi-face-inner {
  inset: 0;
}

/* eyebrows */
.komi-face-inner::before,
.komi-face-inner::after {
  content: "";
  top: 2.6rem;
  height: 1.2rem;
  width: 2.4rem;
  border-radius: 100%;
  border: 0.35rem solid transparent;
  border-top-color: var(--primary-color);
}

.komi-face-inner::before {
  left: 2.05rem;
  transform: rotate(-7deg);
}

.komi-face-inner::after {
  right: 2.05rem;
  transform: rotate(7deg);
}

.komi-hair-back {
  top: -2rem;
  left: -2rem;
  width: 120%;
}

.komi-hair-back-1 {
  width: 100%;
  height: 9.5rem;
  transform: rotate(-10deg);
  border-radius: 100%;
  background-color: var(--primary-color);
  box-shadow:
    -1.3rem 2.3rem 0 -2.5rem var(--primary-color),
    1.5rem 2.5rem 0 -2.2rem var(--primary-color),
    0.5rem -1.25rem 0 -2.1rem var(--primary-color),
    -2.3rem 0.7rem 0 -2.6rem var(--primary-color),
    2.4rem -0.5rem 0 -2.4rem var(--primary-color);
}

.komi-hair-back-1::before,
.komi-hair-back-1::after {
  content: "";
}

.komi-hair-back-1::before {
  top: 5.5rem;
  right: -1rem;
  width: 50%;
  height: 60%;
  background-color: inherit;
  border-radius: 100%;
  box-shadow: -0.25rem 3rem 0 -2rem var(--primary-color);
}

.komi-hair-back-1::after {
  inset: 0;
  border-radius: inherit;
  border-left: 1rem solid var(--primary-color);
}

.komi-hair-lines {
  top: -3rem;
  left: -2rem;
  width: 17rem;
  height: 16rem;
  overflow: visible;
  z-index: 1;
  pointer-events: none;
}

.komi-hair-lines path {
  stroke: var(--hair-line);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.komi-hair-front {
  z-index: 1;
  top: -0.2rem;
  left: 14%;
  width: 72%;
  height: 3rem;
  background-color: var(--primary-color);
  clip-path: url(#hair-front-path);
}

.komi-hair-bangs {
  display: none;
}

.komi-hair-bangs::before,
.komi-hair-bangs::after {
  content: "";
  z-index: 2;
  background-color: var(--primary-color-tint);
}

.komi-hair-bangs::before {
  top: 2.5rem;
  left: -3.75rem;
  height: 1rem;
  width: 1rem;
  transform: rotate(-2deg) skewY(20deg);
  border-radius: 0.25rem;
}

.komi-hair-bangs::after {
  top: 2.25rem;
  left: 0.5rem;
  height: 1rem;
  width: 90%;
  transform: rotate(-2deg) skewY(10deg);
  border-radius: 0.25rem;
}

.komi-hair-bangs-1,
.komi-hair-bangs-2 {
  transform-origin: center top;
  background-color: var(--primary-color);
}

.komi-hair-bangs-1 {
  top: 0;
  left: 0;
  width: 55%;
  height: 6rem;
  transform: rotate(-8deg);
  border-bottom-left-radius: 100% 50%;
}

.komi-hair-bangs-1::before {
  content: "";
  left: -1.5rem;
  height: 80%;
  width: 3rem;
  border-bottom-left-radius: 100%;
  transform: rotate(50deg);
  border-left: 1.5rem solid var(--primary-color);
}

.komi-hair-bangs-2 {
  top: 0;
  left: 50%;
  width: 45%;
  height: 6.5rem;
  transform: rotate(-12deg);
  border-bottom-left-radius: 100% 70%;
}

.komi-hair-bangs-3 {
  top: 1.5rem;
  left: -1.75rem;
  height: 6rem;
  width: 4.5rem;
  border-bottom-left-radius: 100%;
  transform-origin: center top;
  transform: rotate(45deg);
  border-left: 1.75rem solid var(--primary-color);
}

.komi-hair-strand {
  z-index: -1;
  top: 4rem;
  left: -1rem;
  height: 13rem;
  width: 4rem;
  background-color: var(--primary-color);
  clip-path: url(#hair-lock-path);
}

.komi-head {
  position: relative;
  z-index: 10;
  height: 12rem;
  width: 13rem;
  margin: 0 auto 5rem;
}

.komi-hair-extension {
  top: 3rem;
  left: calc(50% - 6.7rem);
  width: 13.7rem;
  height: 14rem;
  background-color: var(--primary-color);
  clip-path: url(#hair-mass-path);
}

.komi-hair-extension::after {
  content: "";
  left: 1rem;
  height: 100%;
  width: 5rem;
  background-color: var(--primary-color-dark);
}

.komi-neck {
  z-index: 2;
  bottom: calc(100% - 0.25rem);
  left: 50%;
  height: 5rem;
  width: 2rem;
  transform: translateX(-50%);
  background-color: var(--secondary-color);
}

.komi-neck::after {
  content: "";
  z-index: -1;
  top: calc(100% - 0.125rem);
  left: 50%;
  border: 1.125rem solid transparent;
  border-top-color: var(--secondary-color);
  transform: translateX(-50%);
}

.komi-neck-shadow {
  inset: 0;
  overflow: hidden;
}

.komi-neck-shadow::before {
  content: "";
  top: 0.25rem;
  left: 50%;
  width: 250%;
  height: 3rem;
  border-radius: 100%;
  background-color: var(--black);
  transform: translateX(-50%);
  opacity: 0.1;
}

.komi-collar {
  --flip: 1;
  --collar-offset: -4.4375rem;
  bottom: -0.5rem;
  left: 50%;
  height: 3rem;
  width: 100%;
  transform: translateX(-50%) skewY(calc(-15deg * var(--flip))) scaleY(0.6);
}

.komi-collar::before {
  top: 0.5rem;
  right: var(--collar-right);
  bottom: auto;
  left: var(--collar-left);
  content: "";
  height: 0;
  width: 0;
  border: 2.5rem solid transparent;
  border-top-color: var(--shirt-color);
  transform: rotate(calc(78deg * var(--flip)));
}

.komi-collar-left {
  --collar-left: var(--collar-offset);
}

.komi-collar-right {
  --flip: -1;
  --collar-right: var(--collar-offset);
}

.komi-bow {
  bottom: -1.875rem;
  left: 50%;
  height: 0.75rem;
  width: 1.25rem;
  transform: translateX(-50%);
}

.komi-bow::after {
  content: "";
  z-index: 3;
  inset: 0;
  border-radius: 0.75rem;
  background-color: var(--bow-color-1);
  background-image: var(--bow-gradient);
}

.komi-bow-top {
  --flip: 1;
  --bow-top-offset: 0.75rem;
  z-index: 2;
  inset: 0;
}

.komi-bow-top::before,
.komi-bow-top::after {
  top: -0.25rem;
  right: var(--bow-top-right);
  bottom: auto;
  left: var(--bow-top-left);
  content: "";
  height: 1.75rem;
  width: 1.75rem;
  transform: rotate(calc(-15deg * var(--flip))) perspective(1rem)
    rotateY(calc(22deg * var(--flip)));
  background-color: var(--bow-color-1);
  background-image: var(--bow-gradient);
  border-radius: 0.25rem;
}

.komi-bow-top::before {
  --bow-top-right: var(--bow-top-offset);
}

.komi-bow-top::after {
  --bow-top-left: var(--bow-top-offset);
  --flip: -1;
}

.komi-bow-top-shadow {
  --bow-top-shadow-offset: 0.75rem;
  inset: 0;
}

.komi-bow-top-shadow::before,
.komi-bow-top-shadow::after {
  top: 0.125rem;
  right: var(--bow-top-shadow-right);
  bottom: auto;
  left: var(--bow-top-shadow-left);
  content: "";
  z-index: 1;
  height: 0.75rem;
  width: 1.25rem;
  transform: rotate(calc(-15deg * var(--flip)));
  border-radius: 100%;
  background-color: var(--bow-color-2);
  mix-blend-mode: multiply;
  opacity: 0.4;
}

.komi-bow-top-shadow::before {
  --bow-top-shadow-right: var(--bow-top-shadow-offset);
}

.komi-bow-top-shadow::after {
  --bow-top-shadow-left: var(--bow-top-shadow-offset);
  --flip: -1;
}

.komi-bow-bottom {
  --flip: 1;
  --bow-bottom-offset: -1.5rem;
  z-index: 1;
  inset: 0;
}

.komi-bow-bottom::before,
.komi-bow-bottom::after {
  top: 0.325rem;
  right: var(--bow-bottom-right);
  bottom: auto;
  left: var(--bow-bottom-left);
  content: "";
  height: 1.75rem;
  width: 2rem;
  transform: rotate(calc(15deg * var(--flip)));
  border-radius: 0.125rem;
  background-color: var(--bow-color-1);
  background-image: var(--bow-gradient);
}

.komi-bow-bottom::before {
  --bow-bottom-left: var(--bow-bottom-offset);
}

.komi-bow-bottom::after {
  --bow-bottom-right: var(--bow-bottom-offset);
  --flip: -1;
}

.komi-shirt {
  --flip: 1;
  z-index: 1;
  top: -0.5rem;
  left: 50%;
  width: 9rem;
  height: 8rem;
  transform: translateX(-50%);
}

.komi-shirt::before,
.komi-shirt::after {
  top: 0;
  right: var(--shirt-right);
  bottom: auto;
  left: var(--shirt-left);
  content: "";
  z-index: 2;
  height: 100%;
  width: 70%;
  border-radius: 0.5rem;
  background-color: var(--shirt-color-dark);
  transform: rotate(calc(8deg * var(--flip)));
}

.komi-shirt::before {
  --shirt-left: 0;
  --flip: -1;
}

.komi-shirt::after {
  --shirt-right: 0;
}

.komi-shirt-sleeves::before,
.komi-shirt-sleeves::after {
  top: 1rem;
  right: var(--shirt-sleeve-right);
  bottom: auto;
  left: var(--shirt-sleeve-left);
  content: "";
  z-index: -1;
  height: 4rem;
  width: 4rem;
  border-radius: 0.25rem;
  background-color: var(--shirt-color-dark);
  transform: rotate(calc(20deg * var(--flip)));
}

.komi-shirt-sleeves::before {
  --shirt-sleeve-left: -1.25rem;
}

.komi-shirt-sleeves::after {
  --shirt-sleeve-right: -1.25rem;
  --flip: -1;
}

.komi-shirt-sleeves,
.komi-shirt-sleeves-shadow {
  inset: 0;
}

.komi-shirt-sleeves-shadow {
  z-index: 1;
}

.komi-shirt-sleeves-shadow::before,
.komi-shirt-sleeves-shadow::after {
  top: 2.5rem;
  right: var(--shirt-sleeve-sh-right);
  bottom: auto;
  left: var(--shirt-sleeve-sh-left);
  content: "";
  height: 50%;
  width: 1.5rem;
  transform: rotate(calc(20deg * var(--flip)));
  background-color: var(--shirt-color-dark-2);
}

.komi-shirt-sleeves-shadow::before {
  --shirt-sleeve-sh-left: -1rem;
}

.komi-shirt-sleeves-shadow::after {
  --shirt-sleeve-sh-right: -1rem;
  --flip: -1;
}

.komi-body {
  z-index: 1;
  top: 12rem;
  left: calc(50% - 6rem);
  height: 6rem;
  width: 12rem;
}

.komi-panel {
  top: 2rem;
  left: 50%;
  width: clamp(20rem, 50vw, 30rem);
  height: 15rem;
  transform: translateX(-50%);
  background-color: var(--komi-panel);
  overflow: hidden;
  z-index: 1;
}

.komi-head.ears {
  --eye-pupil-scale: 1.1;
  --eye-sparkle-scale: 1;
  --blush-opacity: 0.3;
  --cat-ear-scale: 1;
  --cat-ear-translate: -3rem;
  --cat-ear-animation: catEarTwitch 3s 0.5s infinite;
}

.komi-head.ready {
  cursor: pointer;
}

.komi-head.ears,
.komi-head.ears + .komi-panel {
  animation: none;
}

@keyframes blinky {
  0% {
    transform: scaleY(1);
  }
  32% {
    transform: scaleY(0.06);
  }
  46% {
    transform: scaleY(0.06);
  }
  100% {
    transform: scaleY(1);
  }
}

@keyframes winkClose {
  0% {
    transform: scaleY(1);
  }
  22% {
    transform: scaleY(0);
  }
  60% {
    transform: scaleY(0);
  }
  100% {
    transform: scaleY(1);
  }
}

@keyframes winkLid {
  0%,
  14% {
    opacity: 0;
  }
  24%,
  58% {
    opacity: 1;
  }
  70%,
  100% {
    opacity: 0;
  }
}

@keyframes winkTilt {
  0% {
    transform: rotate(0deg);
  }
  30% {
    transform: rotate(3deg);
  }
  66% {
    transform: rotate(3deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

@keyframes winkBlush {
  0% {
    opacity: var(--blush-opacity, 0.22);
    transform: scale(1);
  }
  40% {
    opacity: 0.5;
    transform: scale(1.18);
  }
  100% {
    opacity: var(--blush-opacity, 0.22);
    transform: scale(1);
  }
}

@keyframes twinkleY {
  0%,
  100% {
    transform: translateX(-50%) scaleY(1);
  }

  50% {
    transform: translateX(-50%) scaleY(0.5);
  }
}

@keyframes twinkleX {
  0%,
  100% {
    transform: translateY(-50%) scaleX(1);
  }

  50% {
    transform: translateY(-50%) scaleX(0.5);
  }
}

@keyframes catEarTwitch {
  0%,
  70%,
  90% {
    transform: rotate(0deg);
  }

  80%,
  95% {
    transform: rotate(5deg) scaleX(0.9);
  }
}

/* ===== scene ===== */
.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--bg-base);
}

.room-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.room-bg .grad {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #f4ecdb 0%, #ece3d0 55%, #e3d7bd 100%);
}
.plant {
  position: fixed;
  left: var(--plantLeft, 70%);
  top: var(--giftTop, 80%);
  z-index: 7;
  width: 52px;
  transform: translateY(-100%);
  transform-origin: bottom center;
}
.plant svg {
  display: block;
  width: 100%;
}

/* gifts and envelope hop; the shadow ellipse stays on the table */
.gifts .box.hop,
.plant svg.hop {
  animation: propHop 0.55s cubic-bezier(0.34, 1.4, 0.64, 1);
  transform-origin: 50% 100%;
}

@keyframes propHop {
  0%,
  100% {
    transform: translateY(0) scale(1, 1);
  }
  18% {
    transform: translateY(2px) scale(1.06, 0.9);
  }
  50% {
    transform: translateY(-12px) scale(0.96, 1.05);
  }
  78% {
    transform: translateY(0) scale(1.04, 0.94);
  }
}

.signature {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(2.2% + env(safe-area-inset-bottom, 0px));
  padding: 0.3em 0;
  transform: rotate(-4deg);
  text-align: center;
  z-index: 8;
  font-family: "Caveat", cursive;
  font-weight: 600;
  font-size: clamp(1.15rem, 4.5vw, 1.7rem);
  color: rgba(244, 236, 218, 0.85);
  white-space: nowrap;
  pointer-events: none;
}

.table-front {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--floorY, 62%);
  bottom: 0;
  z-index: 6;
  pointer-events: none;
  background: linear-gradient(180deg, #ddd0b6 0%, #cec0a0 42%, #a2906c 100%);
}
.table-front::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 7px;
  background: linear-gradient(180deg, rgba(60, 44, 26, 0.1), transparent);
}

.gifts {
  position: fixed;
  left: var(--giftLeft, 18px);
  top: var(--giftTop, 80%);
  width: 58px;
  z-index: 7;
}
.gifts .gift {
  position: absolute;
  bottom: 0;
}
.gifts .box {
  display: block;
}
.gifts .g1 {
  left: 0;
  cursor: pointer;
}
.gifts .g1 .box {
  width: 58px;
  height: 50px;
}
.gifts .box.shake {
  animation: giftShake 0.3s ease;
  transform-origin: 50% 100%;
}
@keyframes giftShake {
  0%,
  100% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(calc(var(--amp, 4deg) * -1));
  }
  65% {
    transform: rotate(var(--amp, 4deg));
  }
}
.gifts .gift.open .box {
  transform: rotate(-3deg);
}
.gift-pop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 24, 16, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.gift-pop.show {
  opacity: 1;
  pointer-events: auto;
}
.gift-pop__card {
  position: relative;
  max-width: min(78vw, 320px);
  background: #4b6b4a;
  color: #f4eeda;
  text-align: center;
  font-family: "Shantell Sans", cursive;
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.4;
  padding: 1.7rem 1.5rem 1.4rem;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(40, 30, 18, 0.35);
  transform: scale(0.92);
  transition: transform 0.25s ease;
}
.gift-pop.show .gift-pop__card {
  transform: scale(1);
}
.gift-pop__close {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #f4eeda;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.gift-pop__close:hover {
  background: rgba(244, 238, 218, 0.14);
}
/* the lid flies off when the box opens, leaving the dark inside visible */
.gifts .gift.open .box .gift-lid {
  animation: lidPop 0.6s ease forwards;
}
@keyframes lidPop {
  to {
    transform: translateY(-44px) rotate(26deg);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .gifts .box.shake {
    animation: none;
  }
}
/* unwrapping: the ribbon loosens then slips off, then the lid gets pried up */
.gifts .box .gift-ribbon,
.gifts .box .gift-lid {
  transition:
    transform 0.25s ease,
    opacity 0.3s ease;
  transform-box: fill-box;
  transform-origin: 50% 50%;
}
.gifts .box.worn1 .gift-ribbon {
  transform: rotate(7deg);
}
.gifts .box.worn2 .gift-ribbon {
  transform: translateY(32px) rotate(24deg);
  opacity: 0;
}
.gifts .box.worn2 .gift-lid {
  transform: rotate(-3deg);
}
.gifts .box.worn3 .gift-lid {
  transform: translateY(-5px) rotate(-9deg);
}
/* the inside shows only once the lid is pried up */
.gifts .box .gift-inside {
  opacity: 0;
  transition: opacity 0.25s ease;
}
.gifts .box.worn3 .gift-inside,
.gifts .gift.open .box .gift-inside {
  opacity: 1;
}

.gifts::after,
.plant::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(64, 47, 29, 0.16);
  z-index: -1;
}
.gifts::after {
  width: 66px;
  height: 12px;
}
.plant::after {
  width: 40px;
  height: 9px;
  bottom: -4px;
}

.room-dim {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
  background: radial-gradient(
    circle 240px at var(--fx, 50%) var(--fy, 52%),
    rgba(20, 14, 6, 0) 40%,
    rgba(20, 14, 6, 0.62) 100%
  );
}

.room-glow {
  position: fixed;
  inset: 0;
  z-index: 49;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease;
  mix-blend-mode: soft-light;
  background: radial-gradient(
    circle 200px at var(--fx, 50%) var(--fy, 52%),
    rgba(255, 197, 110, 0.5),
    rgba(255, 197, 110, 0) 62%
  );
}

body.lit .room-dim,
body.lit .room-glow {
  opacity: 1;
}

.bunting {
  position: absolute;
  top: 0.3rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 560px);
  height: 9.6rem;
  pointer-events: none;
}

.bunting svg {
  display: block;
  width: 100%;
  height: 100%;
}

.bunting .flag-cloth {
  transform-box: fill-box;
  transform-origin: 50% 0;
}

.bunting .flag-cloth.flap {
  animation: flagFlap 0.9s ease-in-out;
}

@keyframes flagFlap {
  0%,
  100% {
    transform: rotate(0);
  }
  30% {
    transform: rotate(3deg);
  }
  65% {
    transform: rotate(-2deg);
  }
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse 74% 64% at 50% 44%,
    transparent 58%,
    rgba(74, 52, 32, 0.2) 100%
  );
}

.grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.12;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

.scene-content {
  position: relative;
  margin-top: 9rem;
}

/* tall phones: drop the character and table to widen the message band */
@media (max-width: 480px) and (min-height: 640px) {
  .scene-content {
    margin-top: 10.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .grain {
    opacity: 0.08;
  }
}

/* ===== cake ===== */
:root {
  --plate-background: #f4efe2;
  --plate-base-box-shadow: #9a927f;
  --cake-base-background: #6b4128;
  --cake-topping: #3c2415;
}

*,
*:before,
*:after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.svg {
  position: absolute;
  width: 0;
  height: 0;
}

.wrapper,
.plate,
.candle-container {
  display: grid;
  place-items: center;
}

.wrapper {
  position: relative;
  transform: scale(0.65);
  z-index: 10;
  bottom: 2.2rem;
  cursor: pointer;
}

.smoke {
  position: absolute;
  top: -6px;
  left: 50%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: rgba(120, 120, 120, 0.5);
  filter: blur(3px);
  pointer-events: none;
  z-index: 100;
}

.plate {
  position: relative;
  width: 250px;
  height: 75px;
  background: var(--plate-background);
  margin-top: 0;
  border-radius: 50%;
  box-shadow: 0px 3px 5px 0px var(--plate-base-box-shadow);
}

.cake-wrap {
  position: absolute;
  bottom: 50%;
}

.cake-base {
  position: relative;
  width: 200px;
  height: 50px;
  background: var(--cake-base-background);
}

.cake-base .base-front {
  position: absolute;
  width: 100%;
  height: 100%;
  background: inherit;
}

.cake-base .base-front:after {
  content: "";
  position: absolute;
  left: 0;
  top: 100%;
  width: 100%;
  height: 55px;
  transform: translatey(-50%);
  background: inherit;
  border-radius: 50%;
}

.cake-base .base-top {
  position: absolute;
  width: 100%;
  height: 65px;
  top: 0;
  transform: translatey(-50%);
  border-radius: 50%;
  background: inherit;
}

.cake-base .base-top:before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  clip-path: polygon(0 0, 0% 50%, 100% 50%, 100% 0);
}

.cake-base .base-top:after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border-bottom-color: black;
  clip-path: polygon(0 50%, 60% 50%, 60% 101%, 0 101%);
}

.cake-topping {
  position: absolute;
  bottom: 0%;
  width: 200px;
  height: 100px;
  z-index: 99;
}

.cake-topping .topping-front {
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, var(--cake-topping) 40%, transparent);
}

.cake-topping .topping-front .top-layer {
  height: 30%;
  background: var(--cake-topping);
}

.cake-topping .topping-front .bottom-layer {
  position: relative;
  height: 70%;
  background: var(--cake-topping);
  clip-path: url("#my-clip-path");
}

.cake-topping .topping-top {
  background: var(--cake-topping);
  position: absolute;
  width: 100%;
  height: 65px;
  top: 0;
  transform: translatey(-50%);
  border-radius: 50%;
  z-index: 9;
}

.cake-topping .topping-top:before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  clip-path: polygon(0 0, 0% 50%, 100% 50%, 100% 0);
}

.cake-topping .topping-top:after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: inset 0 -1px 1px 2px rgba(26, 15, 9, 0.45);
  clip-path: polygon(10% 50%, 70% 50%, 70% 101%, 10% 101%);
}

.candle-container {
  width: 200px;
  position: absolute;
  bottom: 60%;
  z-index: 9999;
  opacity: 0;
}

.candle-container .candle-wrap {
  position: relative;
  width: 15px;
}

.candle-container .flame-wrap {
  position: relative;
  z-index: 99;
  width: 100%;
  background: #fcc56c;
  height: 30px;
  transform-origin: bottom center;
  transform: scale(0);
  clip-path: url(#my-flame-path);
}

.candle-container .candle-top {
  position: absolute;
  top: 0;
  left: 0;
  transform: translatey(-50%);
  width: 100%;
  height: 8px;
  background: white;
  border-radius: 50%;
  z-index: 9;
  background: radial-gradient(#f4efe2, var(--c-terracotta));
}

.candle-container .candle-base {
  position: relative;
  width: 100%;
  height: 75px;
  margin: 2px 0;
  background: repeating-linear-gradient(
    45deg,
    #f4efe2,
    var(--c-terracotta) 20%
  );
}

.candle-container .candle-base:before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  background: #eee;
  transform: translateY(50%);
  height: 5px;
  width: 100%;
  z-index: -1;
  border-radius: 50%;
}

.candle-container .candle-base:after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 50%);
  height: 10px;
  width: 200%;
  border-radius: 50%;
  background: radial-gradient(#3c2415, #1f1109);
  z-index: -2;
}

/* ===== canvas ===== */
canvas {
  position: fixed;
  top: 0;
  left: 0;
}
/* ===== words ===== */
/* phones: shrink the rem so the whole scene scales down together */
@media (max-width: 480px) {
  html {
    font-size: 14px;
  }
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  font-family: "Poppins", sans-serif;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

img {
  -webkit-user-drag: none;
  user-drag: none;
}

.hint {
  position: fixed;
  top: var(--hintY, 72%);
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  padding: 0.5rem 1.1rem;
  border-radius: 2rem;
  background: rgba(52, 77, 52, 0.55);
  color: var(--c-cream);
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  animation: hintFade 2.6s ease-in-out infinite;
}

.hint.steady {
  animation: none;
  opacity: 1;
}

.hint.hide {
  opacity: 0;
  pointer-events: none;
  animation: none;
  transition: opacity 0.4s ease;
}

/* fade the hint back in on replay; the pulse resumes at full opacity after */
.hint.appearing {
  animation: none;
  transition: opacity 0.5s ease;
}

.replay {
  position: fixed;
  top: var(--hintY, 72%);
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--c-cream);
  background: rgba(52, 77, 52, 0.55);
  border: 0;
  padding: 0.55rem 1.2rem;
  border-radius: 2rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.5s ease,
    transform 0.2s ease;
}
.replay.show {
  opacity: 1;
  pointer-events: auto;
  animation: replayIn 0.5s ease;
}

@keyframes replayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.replay:hover {
  transform: translateX(-50%) translateY(-1px);
}
.replay:focus-visible {
  outline: 2px solid var(--c-forest);
  outline-offset: 2px;
}

.ear-hint {
  position: absolute;
  top: -3.9rem;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  z-index: 6;
  padding: 0.4rem 0.9rem;
  border-radius: 2rem;
  background: rgba(52, 77, 52, 0.55);
  color: var(--c-cream);
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}

.ear-hint.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  animation: earSway 2.8s ease-in-out 0.6s infinite;
}

@keyframes earSway {
  0%,
  100% {
    transform: translateX(-50%) rotate(-2.2deg);
  }
  50% {
    transform: translateX(-50%) rotate(2.2deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ear-hint.show {
    animation: none;
  }
}

.content {
  position: fixed;
  top: var(--msgY, 30%);
  left: 0;
  width: 100%;
  transform: translateY(-50%);
  text-align: center;
  z-index: 6;
}

.content__line {
  font-family: "Shantell Sans", cursive;
  font-weight: 700;
  font-size: var(--msgFs, clamp(2rem, 8vw, 4rem));
  line-height: 1.15;
  text-wrap: balance;
  color: #3d3226;
  text-shadow: 0 1px 0 rgba(255, 250, 240, 0.4);
  opacity: 0;
  padding: 0 1.4rem;
}

@keyframes hintFade {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hint,
  .replay.show {
    animation: none;
  }
}
