* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  touch-action: manipulation;
}

.hidden {
  display: none !important;
}

.download {
  align-items: center;
  background-color: #ececec;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  justify-content: center;
  left: 0;
  position: fixed;
  top: 0;
  width: 100vw;
  z-index: 100;
}

.download-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 24px;
  min-height: 0;
  overflow: hidden;
  padding: 24px;
  width: 100%;
}

.download-header {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  width: 100%;
}

.download-text {
  color: #333333;
  font-family: "Marcellus", serif;
  font-size: 1rem;
  margin: 0;
}

.download-content img {
  flex: 1;
  height: 0;
  object-fit: contain;
  width: 100%;
}

.icon-btn {
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: center;
  outline: none;
  padding: 0;
}

.icon-btn svg {
  display: block;
  height: 24px;
  width: 24px;
}

body {
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  align-items: center;
  background-color: #ececec;
  display: flex;
  font-family: system-ui, sans-serif;
  height: 100vh;
  height: 100dvh;
  justify-content: center;
  overflow: hidden;
  padding: 24px;
  position: relative;
  text-rendering: optimizeLegibility;
  touch-action: manipulation;
  width: 100vw;
}

@media (hover: hover) {
  body::before {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.5' numOctaves='8' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.5'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
    bottom: 0;
    content: "";
    left: 0;
    mix-blend-mode: overlay;
    pointer-events: none;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 0;
  }
}

#video {
  display: none;
}

#polaroid {
  -webkit-user-select: none;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 16px 32px 0 rgba(31, 31, 31, 0.16);
  cursor: pointer;
  max-width: 640px;
  padding: 24px;
  padding-bottom: 72px;
  pointer-events: auto;
  position: relative;
  transform: rotate(-0.5deg);
  user-select: none;
  width: 100%;
  z-index: 1;
}

body.theme-invert #polaroid {
  background-color: #000000;
}

#video-canvas {
  aspect-ratio: 1 / 1;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  width: 100%;
}

#polaroid-text {
  bottom: 30px;
  color: #333333;
  display: flex;
  font-family: "Marcellus", serif;
  font-size: 13px;
  justify-content: space-between;
  left: 24px;
  line-height: 16px;
  pointer-events: none;
  position: absolute;
  right: 24px;
}

#polaroid-date {
  text-align: left;
}

#polaroid-location {
  text-align: right;
}

body.theme-invert #polaroid-text {
  color: #ffffff;
}

@media (max-width: 768px) {
  #polaroid {
    padding: 20px;
    padding-bottom: 60px;
  }

  #polaroid-text {
    bottom: 24px;
    font-size: 12px;
    left: 20px;
    right: 20px;
  }
}

@keyframes pop {
  0% {
    transform: rotate(-0.5deg) scale(1);
  }
  40% {
    transform: rotate(0deg) scale(0.98);
  }
  60% {
    transform: rotate(0deg) scale(1.02);
  }
  100% {
    transform: rotate(-0.5deg) scale(1);
  }
}

#polaroid.pop {
  animation: pop 0.2s ease-out;
}

#capture-btn {
  align-items: center;
  background: linear-gradient(180deg, #434343 0, #343434 100%) padding-box,
    linear-gradient(#dadada 0%, #363636 50%, #dadada 100%) border-box;
  border: 1px solid transparent;
  border-radius: 50%;
  bottom: 24px;
  box-shadow: 0 0 0 1px #343434, 0 0 4px 0 rgba(31, 31, 31, 0.08),
    0 4px 8px 0 rgba(31, 31, 31, 0.08), 0 1px 2px 0 rgba(31, 31, 31, 0.08),
    0 0 4px 0 rgba(31, 31, 31, 0.08), 0 4px 8px 0 rgba(31, 31, 31, 0.08),
    0 1px 2px 0 rgba(31, 31, 31, 0.08);
  cursor: pointer;
  display: flex;
  height: 64px;
  justify-content: center;
  left: 50%;
  position: absolute;
  transform: translateX(-50%);
  width: 64px;
  z-index: 1;
}

#capture-btn:hover {
  filter: brightness(1.25);
}

#capture-btn:active {
  background: linear-gradient(180deg, #343434 0, #434343 100%) padding-box,
    linear-gradient(#dadada 0%, #363636 50%, #dadada 100%) border-box;
}

#capture-btn svg {
  color: #ffffff;
  filter: drop-shadow(0 -1px 0px rgba(0, 0, 0, 0.25));
}

#error {
  -webkit-user-select: none;
  color: #333333;
  display: flex;
  flex-direction: column;
  font-size: 1rem;
  gap: 1rem;
  pointer-events: none;
  position: relative;
  text-align: center;
  user-select: none;
  z-index: 1;
}

.title {
  -webkit-user-select: none;
  font-family: "Marcellus", serif;
  font-size: 4rem;
  letter-spacing: -2px;
  line-height: 1;
  opacity: 1;
  pointer-events: none;
  user-select: none;
}

.title span:first-child {
  letter-spacing: -24px;
}

.title span:nth-child(2) {
  letter-spacing: -3px;
}

#video-title {
  color: #333333;
  left: 50%;
  line-height: 1;
  position: fixed;
  top: 24px;
  transform: translateX(-50%);
  z-index: 100;
}

#error p {
  line-height: 1.4;
  opacity: 0.8;
}
