:root {
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);

  color-scheme: light;
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #fff;
}

body {
  position: fixed;
  inset: 0;
  padding:
    var(--safe-area-top)
    var(--safe-area-right)
    0
    var(--safe-area-left);
  transition-property: background-color;
  transition-duration: 220ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

body.is-qr-open {
  background: #6b6b6b;
}

button {
  font: inherit;
}

.app-shell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #fff;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  transition-property: opacity, transform, filter;
  transition-duration: 220ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.detached-header,
.detached-footer {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  width: 100%;
  overflow: hidden;
  background: #fff;
}

.detached-header img,
.detached-footer img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

.detached-body {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  background: #fff;
}

.detached-body::-webkit-scrollbar {
  display: none;
}

.body-canvas {
  position: relative;
  width: 100%;
  aspect-ratio: 1179 / 1811;
  background: #fff;
}

.body-canvas > img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

.screen-home .body-canvas::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  width: 27%;
  height: 19%;
  background: #fff;
}

.screen-home {
  z-index: 1;
  opacity: 1;
  transform: scale(1);
  filter: blur(0);
}

.screen-qr {
  z-index: 2;
  display: block;
  opacity: 0;
  transform: translateY(12px);
  filter: blur(4px);
  pointer-events: none;
  background: rgba(0, 0, 0, 0.58);
}

.app-shell.is-qr-open .screen-home {
  opacity: 1;
  transform: scale(1);
  filter: blur(0);
  pointer-events: none;
}

.app-shell.is-qr-open .screen-qr {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
  pointer-events: auto;
}

.qr-open-button,
.qr-close-button {
  position: absolute;
  z-index: 4;
  border: 0;
  border-radius: 999px;
  padding: 0;
  cursor: pointer;
  background: transparent;
  touch-action: manipulation;
  transition-property: scale;
  transition-duration: 120ms;
  transition-timing-function: ease-out;
}

.qr-open-button {
  right: 4.9%;
  bottom: 25.1vw;
  width: 16.5%;
  aspect-ratio: 1;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
}

.qr-close-button {
  position: relative;
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  aspect-ratio: 1;
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.05),
    0 8px 24px rgba(0, 0, 0, 0.14);
}

.qr-open-button img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  user-select: none;
  -webkit-user-drag: none;
}

.qr-open-button:active,
.qr-close-button:active {
  scale: 0.96;
}

.qr-open-button:focus-visible,
.qr-close-button:focus-visible {
  outline: 3px solid #ffd400;
  outline-offset: 3px;
}

.qr-dialog {
  --dialog-width: min(73vw, 289px, calc(100dvh - 390px));

  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding:
    clamp(12px, 2.5dvh, 22px)
    16px
    max(clamp(14px, 2.5dvh, 24px), calc(var(--safe-area-bottom) + 10px));
}

.qr-copy {
  flex: 0 0 auto;
  margin-top: clamp(24px, 8dvh, 72px);
  color: #fff;
  text-align: center;
}

.qr-copy h1 {
  margin: 0;
  font-size: clamp(24px, 6.8vw, 36px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.qr-copy p {
  margin: 8px 0 0;
  font-size: clamp(13px, 3.4vw, 17px);
  font-weight: 650;
  line-height: 1.25;
  text-wrap: pretty;
}

.qr-code-card {
  flex: 0 0 auto;
  width: var(--dialog-width);
  margin-top: clamp(10px, 2dvh, 16px);
  padding: clamp(12px, 3.4vw, 19px);
  border-radius: 16px;
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.05),
    0 12px 36px rgba(0, 0, 0, 0.12);
}

.qr-code-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  image-rendering: pixelated;
}

.qr-progress {
  height: 7px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #eceff3;
}

.qr-progress span {
  display: block;
  width: 96%;
  height: 100%;
  border-radius: inherit;
  background: #ffd400;
}

.qr-toggle-panel {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  width: var(--dialog-width);
  min-height: 49px;
  margin-top: 10px;
  padding: 0 12px 0 14px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04);
  color: #0b0b10;
  font-size: clamp(14px, 4vw, 18px);
  font-weight: 750;
}

.qr-auto-toggle {
  position: relative;
  width: 48px;
  height: 29px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: #e4e7ed;
  cursor: pointer;
  transition-property: background-color;
  transition-duration: 160ms;
  transition-timing-function: ease-out;
}

.qr-auto-toggle span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
  transition-property: transform;
  transition-duration: 160ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.qr-auto-toggle[aria-checked="true"] {
  background: #ffd400;
}

.qr-auto-toggle[aria-checked="true"] span {
  transform: translateX(19px);
}

.qr-dialog-spacer {
  flex: 1 1 auto;
  min-height: 10px;
}

.qr-close-icon,
.qr-close-icon::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 25px;
  height: 5px;
  border-radius: 999px;
  background: #5d5e61;
  content: "";
}

.qr-close-icon {
  transform: translate(-50%, -50%) rotate(45deg);
}

.qr-close-icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

@media (max-height: 640px) {
  .qr-dialog {
    --dialog-width: min(66vw, 255px, calc(100dvh - 330px));
  }

  .qr-copy {
    margin-top: 4px;
  }

  .qr-copy p {
    margin-top: 5px;
  }

  .qr-code-card {
    margin-top: 7px;
    padding: 12px;
  }

  .qr-toggle-panel {
    min-height: 44px;
    margin-top: 7px;
  }

  .qr-close-button {
    width: 48px;
    height: 48px;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .screen,
  .qr-open-button,
  .qr-close-button {
    transition-duration: 0.01ms;
  }
}
