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


* {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  outline: none;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-size: 100%;
  line-height: 1.5;
}

*:active,
*:focus {
  outline: none !important;
  box-shadow: none !important;
}

body {
  font-family: Arial, sans-serif;
}

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

canvas {
  width: 80%;
  margin-top: -17%;
}

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

a {
  text-decoration: none;
  color: inherit;
}

ul,
ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

.mobile-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100svh;
  aspect-ratio: 9 / 16;
  max-width: 100%;
}


body {
  height: 100%;
  width: 100%;
  display: flex;
  justify-self: center;
  align-items: center;
  flex-direction: column;
  overflow: hidden;
  background-color: #000;
}

.step1,
.step1-wrapper,
.result,
.result-wrapper,
.camera-wrapper,
.btns-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.step2 {
  display: flex;
  justify-content: center;
  align-items: center;
}

.btns-wrapper {
  position: absolute;
  bottom: 8.6%;
  left: 28%;
  z-index: 4;
}

.step1,
.result {
  width: 100%;
  height: 100%;
}

.result-frame {
  position: absolute;
  width: 70%;
  top: 4%;
}

.result-frame.pic {
  position: absolute;
  width: 65%;
  top: 1%;
}

.step1-btn {
  position: absolute;
  bottom: 11%;
  width: 38%;
  height: 15%;
}

.retake {
  position: absolute;
  height: 7%;
  bottom: 20%;
  width: 64%;
}


.share {
  position: absolute;
  height: 7%;
  bottom: 12%;
  width: 64%;
}

.share-link {
  position: absolute;
  height: 7%;
  bottom: 3%;
  width: 64%;
}

.download {
  position: absolute;
  width: 55%;
  height: 7%;
  bottom: 14%;
}

.toggle-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
  height: 50px;
  width: 100%;
}

.toggle-button {
  margin-right: -5px;
  background: transparent;
  border: none;
  color: white;
  font-weight: bold;
  font-size: 10px;
  position: relative;
  z-index: 2;
  cursor: pointer;
}

.indicator {
  position: absolute;
  width: 58px;
  height: 22px;
  border-radius: 20px;
  border: 2px solid white;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateX(35px);
  background: transparent;
  transition: transform 0.3s ease;
  z-index: 1;
}

.camera-controls {
  position: absolute;
  bottom: 0%;
  left: 0;
  width: 100%;
  height: 8%;
  /* background-color: rgba(0, 0, 0, 0.8); */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
}

.capture-btn {
  width: 22%;
  position: absolute;
  align-self: center;
}

.switch-btn {
  width: 26%;
  position: absolute;
  right: 0;
}

.album-btn {
  width: 26%;
  position: absolute;
  left: 0;
}

.recording-btn {
  width: 12%;
  position: absolute;
  align-self: center;
}

.result-pic {
  position: absolute;
  width: 56%;
  z-index: 2;
  top: 11.3%;
  left: 22.5%;
  border: 1px solid #fff;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  /* X偏移 Y偏移 模糊 顏色 */
  /* box-shadow: 0 0 10px 8px rgba(44, 179, 180, 1); */
}

.result-video {
  position: absolute;
  width: 56%;
  z-index: 2;
  top: 11.3%;
  left: 22.5%;
  border: 1px solid #fff;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  /* 黑色透明背景 */
  display: flex;
  justify-content: center;
  align-items: center;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 6px solid #ffffff33;
  border-top: 6px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.video-capture-btn {
  position: absolute;
  width: 19%;
  bottom: .1%;
  z-index: 5;
}


.recording-btn {
  position: absolute;
  width: 19%;
  bottom: .5%;
  z-index: 5;
}

.recording-progress {

  border-radius: 50%;
  background: transparent;
  /* 中間透明 */
  display: flex;
  justify-content: center;
  align-items: center;
  bottom: .2%;
  position: absolute;
  z-index: 5;
  z-index: 5;
  width: 74px;
  pointer-events: none;
}


.recording-progress svg {
  pointer-events: none;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  /* 讓進度從上方開始跑 */
}


.recording-progress .progress {
  pointer-events: none;
  fill: none;
  /* 中間透明 */
  stroke: red;
  /* 邊框紅色 */
  stroke-width: 6;
  /* 邊框粗細 */
  stroke-linecap: round;
  /* 邊緣圓滑 */
  stroke-dasharray: 283;
  /* 2πr (r=45 → 2*π*45 ≈ 283) */
  stroke-dashoffset: 283;
  /* 一開始看不到 */
  animation: dash 15s linear forwards;
  /* 動畫 5 秒跑完 */
}


.hidden {
  display: none;
}

.mirror {
  transform: scaleX(-1);
}

@keyframes dash {
  to {
    stroke-dashoffset: 0;
    /* 慢慢繞一圈 */
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loadingGif {
  position: absolute;
  width: 60%;
  left: 20%;
  top: 48%;
  z-index: 4;
}

.frame {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 2;
}

.absolute {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}
