html, body {
  margin: 0;
  overflow: hidden;
}

.stage {
  box-sizing: border-box;
  min-height: 100vh;
  display: grid;
  place-items: center;
  margin: 0;
  background: #17141a;
  font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
  padding: clamp(8px, 4vw, 24px);
}

.fm {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.fm__frame {
  position: relative;
  height: clamp(100px, 52vh, 176px);
  aspect-ratio: 16/10;
  max-width: 100%;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 14px 24px rgba(23, 20, 26, 0.32);
}

.fm__view {
  display: block;
  width: 100%;
  height: 100%;
}

.fm__ghost {
  display: none;
  position: absolute;
  inset: 0;
  background-image: var(--photo);
  background-size: cover;
}

.fm__axis {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 2px dashed rgba(255, 247, 230, 0.72);
}

.fm__sweep {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 22%;
  background: linear-gradient(90deg, rgba(255, 247, 230, 0) 0%, rgba(255, 247, 230, 0.34) 50%, rgba(255, 247, 230, 0) 100%);
  transform: translateX(-120%);
}

.fm__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.fm__btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  border: 1px solid rgba(255, 247, 230, 0.34);
  background: transparent;
  color: #fff7e6;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 700;
  line-height: 1.3;
  font-size: clamp(8px, 2.2vw, 10px);
  padding: 4px 8px;
}

.fm__btn:focus-visible {
  outline: 3px solid #2f6df6;
  outline-offset: 2px;
}

.fm__btn[aria-pressed=true] {
  background: #2f6df6;
  border-color: #2f6df6;
  color: #ffffff;
}

.fm__ico {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
}

.fm__codes {
  position: relative;
  display: inline-block;
  min-width: 72px;
  font-family: ui-monospace, "Consolas", monospace;
  font-size: clamp(8px, 2.1vw, 10px);
  color: rgba(255, 247, 230, 0.78);
}

.fm__demo {
  display: none;
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
}

.fm.is-demo .fm__view {
  visibility: hidden;
}

.fm.is-demo .fm__ghost {
  display: block;
  animation-name: fmFlip;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes fmFlip {
  0%, 24% {
    transform: scaleX(1) scaleY(1);
  }
  25%, 49% {
    transform: scaleX(-1) scaleY(1);
  }
  50%, 74% {
    transform: scaleX(-1) scaleY(-1);
  }
  75%, 88% {
    transform: scaleX(1) scaleY(-1);
  }
  89%, 100% {
    transform: scaleX(1) scaleY(1);
  }
}
.fm.is-demo .fm__sweep {
  animation-name: fmSweep;
  animation-duration: 2s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes fmSweep {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(560%);
  }
}
.fm.is-demo .fm__btn--x {
  animation-name: fmOnX;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

.fm.is-demo .fm__btn--y {
  animation-name: fmOnY;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

@keyframes fmOnX {
  0%, 24% {
    background: transparent;
    border-color: rgba(255, 247, 230, 0.34);
    color: #fff7e6;
  }
  25%, 74% {
    background: #2f6df6;
    border-color: #2f6df6;
    color: #ffffff;
  }
  75%, 100% {
    background: transparent;
    border-color: rgba(255, 247, 230, 0.34);
    color: #fff7e6;
  }
}
@keyframes fmOnY {
  0%, 49% {
    background: transparent;
    border-color: rgba(255, 247, 230, 0.34);
    color: #fff7e6;
  }
  50%, 88% {
    background: #2f6df6;
    border-color: #2f6df6;
    color: #ffffff;
  }
  89%, 100% {
    background: transparent;
    border-color: rgba(255, 247, 230, 0.34);
    color: #fff7e6;
  }
}
.fm.is-demo .fm__real {
  color: transparent;
}

.fm.is-demo .fm__demo {
  display: block;
  animation-duration: 2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

.fm.is-demo .fm__demo--a {
  animation-name: fmCodeA;
}

.fm.is-demo .fm__demo--b {
  animation-name: fmCodeB;
}

.fm.is-demo .fm__demo--c {
  animation-name: fmCodeC;
}

.fm.is-demo .fm__demo--d {
  animation-name: fmCodeD;
}

@keyframes fmCodeA {
  0%, 24% {
    opacity: 1;
  }
  25%, 88% {
    opacity: 0;
  }
  89%, 100% {
    opacity: 1;
  }
}
@keyframes fmCodeB {
  0%, 24% {
    opacity: 0;
  }
  25%, 49% {
    opacity: 1;
  }
  50%, 100% {
    opacity: 0;
  }
}
@keyframes fmCodeC {
  0%, 49% {
    opacity: 0;
  }
  50%, 74% {
    opacity: 1;
  }
  75%, 100% {
    opacity: 0;
  }
}
@keyframes fmCodeD {
  0%, 74% {
    opacity: 0;
  }
  75%, 88% {
    opacity: 1;
  }
  89%, 100% {
    opacity: 0;
  }
}
@media (max-width: 340px) {
  .fm__foot {
    gap: 4px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .fm.is-demo .fm__ghost,
  .fm.is-demo .fm__sweep,
  .fm.is-demo .fm__btn--x,
  .fm.is-demo .fm__btn--y,
  .fm.is-demo .fm__demo {
    animation: none !important;
  }
  .fm.is-demo .fm__ghost {
    transform: scaleX(-1) scaleY(1) !important;
  }
  .fm.is-demo .fm__sweep {
    opacity: 0 !important;
  }
  .fm.is-demo .fm__demo--a,
  .fm.is-demo .fm__demo--c,
  .fm.is-demo .fm__demo--d {
    opacity: 0 !important;
  }
  .fm.is-demo .fm__demo--b {
    opacity: 1 !important;
  }
  .fm.is-demo .fm__btn--x {
    background: #2f6df6 !important;
    border-color: #2f6df6 !important;
    color: #ffffff !important;
  }
}
