:root {
  --device-gate-evening: #0c0907;
  --device-gate-panel: #17100b;
  --device-gate-title: #f6efe8;
  --device-gate-muted: #b9aaa0;
  --device-gate-gold: #e6bd73;
  --device-gate-gold-deep: #c8943b;
  --device-gate-line: rgb(230 189 115 / 0.24);
}

.mobile-handoff-gate,
.orientation-gate,
.auth-orientation-gate {
  display: none;
}

html.is-service-surface.is-non-phone-device body > :not(.mobile-handoff-gate):not(script) {
  display: none !important;
}

html.is-service-surface.is-non-phone-device .mobile-handoff-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  width: 100%;
  min-width: 320px;
  height: 100vh;
  height: 100dvh;
  display: grid;
  place-items: center;
  padding:
    max(24px, env(safe-area-inset-top, 0px))
    max(24px, env(safe-area-inset-right, 0px))
    max(24px, env(safe-area-inset-bottom, 0px))
    max(24px, env(safe-area-inset-left, 0px));
  overflow: auto;
  color: var(--device-gate-title);
  background:
    radial-gradient(circle at 72% 24%, rgb(200 148 59 / 0.2), transparent 30%),
    radial-gradient(circle at 16% 84%, rgb(230 189 115 / 0.1), transparent 34%),
    var(--device-gate-evening);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.mobile-handoff-gate__layout {
  width: min(100%, 980px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  align-items: center;
  gap: clamp(40px, 7vw, 88px);
  margin: auto;
}

.mobile-handoff-gate__message,
.mobile-handoff-gate__transfer,
.mobile-handoff-gate__local-state {
  display: grid;
}

.mobile-handoff-gate__message {
  align-content: center;
  gap: 44px;
}

.mobile-handoff-gate__brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--device-gate-title);
  font-size: 21px;
  font-weight: 760;
  letter-spacing: -0.02em;
}

.mobile-handoff-gate__brand-mark {
  width: 42px;
  height: 42px;
  display: block;
  flex: 0 0 42px;
  background: currentColor;
  -webkit-mask: url("assets/invaito-logo.svg") center / contain no-repeat;
  mask: url("assets/invaito-logo.svg") center / contain no-repeat;
}

.mobile-handoff-gate__intro {
  display: grid;
  gap: 16px;
}

.mobile-handoff-gate h1,
.mobile-handoff-gate p,
.orientation-gate h1,
.orientation-gate p,
.auth-orientation-gate h1,
.auth-orientation-gate p {
  margin: 0;
}

.mobile-handoff-gate h1 {
  max-width: 560px;
  color: var(--device-gate-title);
  font-size: clamp(38px, 5vw, 58px);
  font-weight: 720;
  letter-spacing: -0.045em;
  line-height: 1.02;
}

.mobile-handoff-gate .mobile-handoff-gate__description {
  max-width: 48ch;
  color: var(--device-gate-muted);
  font-size: 17px;
  line-height: 1.55;
}

.mobile-handoff-gate__network-note {
  max-width: 48ch;
  color: var(--device-gate-gold);
  font-size: 14px;
  line-height: 1.5;
}

.mobile-handoff-gate__transfer {
  position: relative;
  min-height: 573px;
  justify-items: center;
  align-content: center;
  gap: 14px;
}

.mobile-handoff-gate__qr-shell {
  width: 264px;
  height: 264px;
  display: grid;
  place-items: center;
  padding: 20px;
  border: 1px solid var(--device-gate-line);
  border-radius: 22px;
  background: #f9f5ef;
  box-shadow: 0 24px 64px rgb(2 1 1 / 0.34);
}

.mobile-handoff-gate__qr {
  width: 224px;
  height: 224px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #62564e;
  background: #f9f5ef;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
}

.mobile-handoff-gate__qr canvas,
.mobile-handoff-gate__qr img {
  width: 224px !important;
  height: 224px !important;
  display: block;
}

.mobile-handoff-gate__copy {
  position: absolute;
  top: calc(50% + 146px);
  min-width: 210px;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid var(--device-gate-line);
  border-radius: 999px;
  color: var(--device-gate-evening);
  background: linear-gradient(135deg, var(--device-gate-gold), var(--device-gate-gold-deep));
  font: inherit;
  font-size: 14px;
  font-weight: 720;
  cursor: pointer;
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1), filter 180ms ease;
}

.mobile-handoff-gate__copy:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.mobile-handoff-gate__copy:active {
  transform: translateY(0);
}

.mobile-handoff-gate__copy:focus-visible {
  outline: 3px solid var(--device-gate-title);
  outline-offset: 3px;
}

.mobile-handoff-gate .mobile-handoff-gate__status {
  position: absolute;
  top: calc(50% + 204px);
  min-height: 21px;
  max-width: 34ch;
  color: var(--device-gate-muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.mobile-handoff-gate__local-state {
  width: 100%;
  min-height: 264px;
  align-content: center;
  gap: 10px;
  padding: 28px;
  border: 1px solid var(--device-gate-line);
  border-radius: 22px;
  background: var(--device-gate-panel);
}

.mobile-handoff-gate__local-state strong {
  color: var(--device-gate-title);
  font-size: 22px;
  line-height: 1.15;
}

.mobile-handoff-gate__local-state p {
  color: var(--device-gate-muted);
  font-size: 14px;
  line-height: 1.5;
}

.mobile-handoff-gate [hidden] {
  display: none !important;
}

@media (orientation: landscape) {
  html.is-service-surface.is-phone-device body > :not(.orientation-gate):not(.auth-orientation-gate):not(script) {
    display: none !important;
  }

  html.is-service-surface.is-phone-device :is(.orientation-gate, .auth-orientation-gate) {
    position: fixed;
    inset: 0;
    z-index: 10000;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    display: grid;
    place-items: center;
    padding:
      max(18px, env(safe-area-inset-top, 0px))
      max(28px, env(safe-area-inset-right, 0px))
      max(18px, env(safe-area-inset-bottom, 0px))
      max(28px, env(safe-area-inset-left, 0px));
    overflow: hidden;
    color: var(--device-gate-title);
    background:
      radial-gradient(circle at 72% 28%, rgb(200 148 59 / 0.16), transparent 32%),
      var(--device-gate-evening);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    text-align: center;
  }
}

.orientation-gate__panel {
  width: min(100%, 440px);
  display: grid;
  place-items: center;
  gap: 12px;
}

.orientation-gate .orientation-gate__device {
  position: relative;
  width: 54px;
  height: 88px;
  display: block;
  border: 2px solid var(--device-gate-gold);
  border-radius: 16px;
  transform-origin: center;
  animation: device-gate-phone-turn 3.2s cubic-bezier(0.65, 0, 0.35, 1) infinite both;
}

.orientation-gate .orientation-gate__device::before,
.orientation-gate .orientation-gate__device::after {
  position: absolute;
  left: 50%;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  content: "";
  background: var(--device-gate-gold);
  transform: translateX(-50%);
}

.orientation-gate .orientation-gate__device::before {
  top: 8px;
}

.orientation-gate .orientation-gate__device::after {
  bottom: 8px;
}

.orientation-gate h1,
.auth-orientation-gate h1 {
  color: var(--device-gate-title);
  font-size: 28px;
  font-weight: 720;
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.orientation-gate p,
.auth-orientation-gate p {
  max-width: 42ch;
  color: var(--device-gate-muted);
  font-size: 14px;
  line-height: 1.45;
}

@keyframes device-gate-phone-turn {
  0%,
  18%,
  96%,
  100% {
    transform: rotate(90deg) scale(0.96);
  }

  42%,
  72% {
    transform: rotate(0deg) scale(1);
  }
}

@media (max-width: 759px) and (min-height: 481px) {
  .mobile-handoff-gate__layout {
    width: min(100%, 520px);
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .mobile-handoff-gate__message {
    gap: 24px;
  }

  .mobile-handoff-gate h1 {
    font-size: 38px;
  }
}

@media (min-width: 520px) and (max-height: 480px) {
  html.is-service-surface.is-non-phone-device .mobile-handoff-gate {
    padding: 16px 24px;
  }

  .mobile-handoff-gate__layout {
    grid-template-columns: minmax(0, 1fr) 176px;
    gap: 28px;
  }

  .mobile-handoff-gate__message {
    gap: 18px;
  }

  .mobile-handoff-gate__brand {
    font-size: 18px;
  }

  .mobile-handoff-gate__brand-mark {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .mobile-handoff-gate h1 {
    font-size: 30px;
  }

  .mobile-handoff-gate__description,
  .mobile-handoff-gate__network-note {
    font-size: 13px;
  }

  .mobile-handoff-gate__transfer {
    min-height: 0;
    gap: 8px;
  }

  .mobile-handoff-gate__copy,
  .mobile-handoff-gate .mobile-handoff-gate__status {
    position: static;
  }

  .mobile-handoff-gate__qr-shell {
    width: 152px;
    height: 152px;
    padding: 12px;
    border-radius: 16px;
  }

  .mobile-handoff-gate__qr,
  .mobile-handoff-gate__qr canvas,
  .mobile-handoff-gate__qr img {
    width: 128px !important;
    height: 128px !important;
  }

  .mobile-handoff-gate__copy {
    min-width: 176px;
    min-height: 44px;
  }

  .mobile-handoff-gate__status {
    min-height: 0;
    font-size: 12px;
  }

  .mobile-handoff-gate__local-state {
    min-height: 152px;
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-handoff-gate__copy {
    transition: none;
  }

  .orientation-gate .orientation-gate__device {
    animation: none !important;
    transform: rotate(0deg);
  }
}
