*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

body, h1, h2, h3, h4, p,
figure, blockquote, dl, dd {
  margin-block-end: 0;
}

ul[role='list'],
ol[role='list'] {
  list-style: none;
}

body {
  min-height: 100vh;
  line-height: 1.5;
}

h1, h2, h3, h4,
button, input, label {
  line-height: 1.1;
}

h1, h2,
h3, h4 {
  text-wrap: balance;
}

a:not([class]) {
  text-decoration-skip-ink: auto;
  color: currentColor;
}

img,
picture {
  max-width: 100%;
  display: block;
}

input, button,
textarea, select {
  font-family: inherit;
  font-size: inherit;
}

textarea:not([rows]) {
  min-height: 10em;
}

:target {
  scroll-margin-block: 5ex;
}

/* actual styles */

:root {
  --color-background: #3e3c4a;
  --color-shadow-1: #ff3366;
  --color-shadow-2: #cc0066;
  --color-shadow-3: #990099;
  --color-shadow-4: #660066;
  --color-shadow-5: #330033;
  --color-border: #5a2067;

  --avatar-size: 256px;
  --shadow-layer-1: 0 2px 0;
  --shadow-layer-2: 0 4px 0;
  --shadow-layer-3: 0 6px 0;
  --shadow-layer-4: 0 8px 0;
  --shadow-layer-5: 0 10px 0;
  --shadow-depth: 0 12px 24px rgba(138, 36, 68, 0.3);
  --shadow-active: 0 2px 8px rgba(138, 36, 68, 0.2);
  --push-distance: 6px;
  --outline-width: 3px;
  --outline-offset: 4px;

  --z-avatar: 10;
  --z-clone: 1;

  --transition-speed: 0.1s;
  --animation-duration: 0.25s;
  --reduced-motion-duration: 0.01ms;

  --easing-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --scale-overshoot: 1.15;

  --radius-circle: 50%;
}

.avatar-wrap {
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  user-select: none;
}

.avatar {
  -webkit-user-select: none;
  user-select: none;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.avatar-flash {
  position: absolute;
  top: 0;
  left: 0;
  -webkit-user-select: none;
  user-select: none;
  width: 100%;
  height: auto;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  will-change: opacity;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.avatar-flash.showing {
  opacity: 1;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

.container {
  width: 100dvw;
  height: 100dvh;
  display: grid;
  place-items: center;
  background: var(--color-background);
}

.avatar-wrap {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: var(--radius-circle);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  z-index: var(--z-avatar);
  box-shadow: var(--shadow-layer-1) var(--color-shadow-1),
              var(--shadow-layer-2) var(--color-shadow-2),
              var(--shadow-layer-3) var(--color-shadow-3),
              var(--shadow-layer-4) var(--color-shadow-4),
              var(--shadow-layer-5) var(--color-shadow-5),
              var(--shadow-depth);
  transition: transform var(--transition-speed) ease,
              box-shadow var(--transition-speed) ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  will-change: transform, box-shadow;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;

  &:focus-visible {
    outline: var(--outline-width) solid var(--color-border);
    outline-offset: var(--outline-offset);
  }

  &:active,
  &.pressed {
    transform: translateY(var(--push-distance));
    box-shadow: var(--shadow-active);
  }
}

.clone {
  position: absolute;
  pointer-events: none;
  cursor: default;
  z-index: var(--z-clone);
  box-shadow: none;
  transition: none;
  border: 2px solid var(--color-border);
  animation: pop-in var(--animation-duration) var(--easing-bounce);
}

@keyframes pop-in {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  60% {
    transform: scale(var(--scale-overshoot));
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: var(--reduced-motion-duration) !important;
    animation-iteration-count: 1 !important;
    transition-duration: var(--reduced-motion-duration) !important;
  }
}
